private void validateTableStructure(IHMSHandler hmsHandler, Table table)
    throws MetaException {
    Warehouse wh = hmsHandler.getWh();
    if (isPartitionedTable(table)) {
      // Validate each partition directory
      List<Partition> partitions = getTablePartitions(hmsHandler, table);
      for (Partition partition : partitions) {
        Path partPath = wh.getDnsPath(new Path(partition.getSd().getLocation()));
        validateTableStructureForPath(hmsHandler, wh, table, partPath);
      }
    } else {
      // Non-partitioned - only need to worry about the base table directory
      Path tablePath = getTablePath(hmsHandler, wh, table);
      validateTableStructureForPath(hmsHandler, wh, table, tablePath);
    }
  }
It's assumed everywhere that original data files are named according to
{@link #ORIGINAL_PATTERN} or{@link #ORIGINAL_PATTERN_COPY}
This checks that when transaction=true is set and throws if it finds any files that don't
follow convention.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/TransactionalValidationListener.java