private void validateTableStructureForPath(IHMSHandler hmsHandler, Warehouse wh, Table table, Path tablePath) throws MetaException {
    try {
      FileSystem fs = wh.getFs(tablePath);
      //FileSystem fs = FileSystem.get(getConf());
      FileUtils.RemoteIteratorWithFilter iterator =
          new FileUtils.RemoteIteratorWithFilter(fs.listFiles(tablePath, true), FileUtils
              .RemoteIteratorWithFilter.HIDDEN_FILES_FULL_PATH_FILTER);
      while (iterator.hasNext()) {
        LocatedFileStatus fileStatus = iterator.next();
        if (!fileStatus.isFile()) {
          continue;
        }
        boolean validFile =
          (ORIGINAL_PATTERN.matcher(fileStatus.getPath().getName()).matches() ||
            ORIGINAL_PATTERN_COPY.matcher(fileStatus.getPath().getName()).matches()
          );
        if (!validFile) {
          throw new IllegalStateException("Unexpected data file name format.  Cannot convert " +
            Warehouse.getQualifiedName(table) + " to transactional table.  File: "
            + fileStatus.getPath());
        }
      }
    } catch (IOException e) {
      String msg = "Unable to list files for " + Warehouse.getQualifiedName(table);
      LOG.error(msg, e);
      MetaException e1 = new MetaException(msg);
      e1.initCause(e);
      throw e1;
    }
  }
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