public static void checkAcidVersion(RemoteIterator<LocatedFileStatus> files, FileSystem fs, boolean hasVersionFile,
      String[] expectedTypes) throws IOException
  {
    Set<String> foundPrefixes = new HashSet<>(expectedTypes.length);
    Set<String> foundDirectories = new HashSet<>(expectedTypes.length);
    while(files.hasNext()) {
      LocatedFileStatus file = files.next();
      Path path = file.getPath();
      if (!path.getName().equals(AcidUtils.OrcAcidVersion.ACID_FORMAT)) {
        int version = getAcidVersionFromDataFile(path, fs);
        //check that files produced by compaction still have the version marker
        Assert.assertEquals("Unexpected version marker in " + path.getName(),
            AcidUtils.OrcAcidVersion.ORC_ACID_VERSION, version);
      }
      Path parent = path.getParent();
      if (!foundDirectories.contains(parent)) {
        if (parent.getName().startsWith(AcidUtils.BASE_PREFIX)) {
          foundPrefixes.add(AcidUtils.BASE_PREFIX);
        } else if (parent.getName().startsWith(AcidUtils.DELTA_PREFIX)) {
          foundPrefixes.add(AcidUtils.DELTA_PREFIX);
        } else if (parent.getName().startsWith(AcidUtils.DELETE_DELTA_PREFIX)) {
          foundPrefixes.add(AcidUtils.DELETE_DELTA_PREFIX);
        }
        // It is a directory
        if (hasVersionFile) {
          Assert.assertTrue("Version marker should exists",
              fs.exists(AcidUtils.OrcAcidVersion.getVersionFilePath(parent)));
          int versionFromMetaFile = getAcidVersionFromMetaFile(parent, fs);
          Assert.assertEquals("Unexpected version marker in " + parent,
              AcidUtils.OrcAcidVersion.ORC_ACID_VERSION, versionFromMetaFile);
        } else {
          Assert.assertFalse("Version marker should not exists",
              fs.exists(AcidUtils.OrcAcidVersion.getVersionFilePath(parent)));
        }
      }
    }
    Assert.assertEquals("Did not found all types of directories", new HashSet<>(Arrays.asList(expectedTypes)),
        foundPrefixes);
  }
This is smart enough to handle streaming ingest where there could be a
{@link AcidUtils#DELTA_SIDE_FILE_SUFFIX} side file.
@param dataFile - ORC acid data file
@return version property from file if there,
         {@link #ORC_ACID_VERSION_DEFAULT} otherwise
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtilities.java