private static int getAcidVersionFromDataFile(Path dataFile, FileSystem fs) throws IOException {
    FileStatus fileStatus = fs.getFileStatus(dataFile);
    try (Reader orcReader = OrcFile.createReader(dataFile,
        OrcFile.readerOptions(fs.getConf())
            .filesystem(fs)
            //make sure to check for side file in case streaming ingest died
            .maxLength(AcidUtils.getLogicalLength(fs, fileStatus)))) {
      if (orcReader.hasMetadataValue(AcidUtils.OrcAcidVersion.ACID_VERSION_KEY)) {
        char[] versionChar =
            UTF8.decode(orcReader.getMetadataValue(AcidUtils.OrcAcidVersion.ACID_VERSION_KEY)).array();
        String version = new String(versionChar);
        return Integer.valueOf(version);
      }
    }
    return ORC_ACID_VERSION_DEFAULT;
  }
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