static boolean isCompacted(Path baseOrDeltaDir, FileSystem fs, HdfsDirSnapshot dirSnapshot) throws IOException {
      /**
       * this file was written by Hive versions before 4.0 into a base_x/ dir
       * created by compactor so that it can be distinguished from the one
       * created by Insert Overwrite
       */
      if (dirSnapshot != null && dirSnapshot.getMetadataFile() == null) {
        return false;
      }
      Path formatFile = new Path(baseOrDeltaDir, METADATA_FILE);
      try (FSDataInputStream strm = fs.open(formatFile)) {
        Map<String, String> metaData = new ObjectMapper().readValue((InputStream)strm, Map.class);
        if (!CURRENT_VERSION.equalsIgnoreCase(metaData.get(Field.VERSION.toString()))) {
          throw new IllegalStateException("Unexpected Meta Data version: " + metaData.get(Field.VERSION));
        }
        String dataFormat = metaData.getOrDefault(Field.DATA_FORMAT.toString(), "null");
        DataFormat format = DataFormat.valueOf(dataFormat.toUpperCase());
        return DataFormat.COMPACTED == format;
      } catch (FileNotFoundException e) {
        return false;
      } catch (IOException e) {
        String msg = "Failed to read " + baseOrDeltaDir + "/" + METADATA_FILE + ": " + e.getMessage();
        LOG.error(msg, e);
        throw e;
      }
    }
General facility to place a metadata file into a dir created by acid/compactor write.

Load Data commands against Acid tables write {@link AcidBaseFileType#ORIGINAL_BASE} type files
into delta_x_x/ (or base_x in case there is Overwrite clause).  {@link MetaDataFile} is a
small JSON file in this directory that indicates that these files don't have Acid metadata
columns and so the values for these columns need to be assigned at read time/compaction.
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java