@Test public void testCommitMetadataCreation() { List<HoodieWriteStat> writeStats = new ArrayList<>(); writeStats.add(createWriteStat("p1", "f1")); writeStats.add(createWriteStat("p2", "f2")); Map<String, List<String>> partitionToReplaceFileIds = new HashMap<>(); List<String> replacedFileIds = new ArrayList<>(); replacedFileIds.add("f0"); partitionToReplaceFileIds.put("p1", replacedFileIds); HoodieCommitMetadata commitMetadata = CommitUtils.buildMetadata(writeStats, partitionToReplaceFileIds, Option.empty(), WriteOperationType.INSERT, TRIP_SCHEMA, HoodieTimeline.DELTA_COMMIT_ACTION); assertFalse(commitMetadata instanceof HoodieReplaceCommitMetadata); assertEquals(2, commitMetadata.getPartitionToWriteStats().size()); assertEquals("f1", commitMetadata.getPartitionToWriteStats().get("p1").get(0).getFileId()); assertEquals("f2", commitMetadata.getPartitionToWriteStats().get("p2").get(0).getFileId()); assertEquals(WriteOperationType.INSERT, commitMetadata.getOperationType()); assertEquals(TRIP_SCHEMA, commitMetadata.getMetadata(HoodieCommitMetadata.SCHEMA_KEY)); }
public static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats, Map<String, List<String>> partitionToReplaceFileIds, Option<Map<String, String>> extraMetadata, WriteOperationType operationType, String schemaToStoreInCommit, String commitActionType) { HoodieCommitMetadata commitMetadata = buildMetadataFromStats(writeStats, partitionToReplaceFileIds, commitActionType, operationType); if (extraMetadata.isPresent()) { extraMetadata.get().forEach(commitMetadata::addMetadata); } commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, schemaToStoreInCommit); commitMetadata.setOperationType(operationType); return commitMetadata; }
CommitUtils { public static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats, Map<String, List<String>> partitionToReplaceFileIds, Option<Map<String, String>> extraMetadata, WriteOperationType operationType, String schemaToStoreInCommit, String commitActionType) { HoodieCommitMetadata commitMetadata = buildMetadataFromStats(writeStats, partitionToReplaceFileIds, commitActionType, operationType); if (extraMetadata.isPresent()) { extraMetadata.get().forEach(commitMetadata::addMetadata); } commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, schemaToStoreInCommit); commitMetadata.setOperationType(operationType); return commitMetadata; } }
CommitUtils { public static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats, Map<String, List<String>> partitionToReplaceFileIds, Option<Map<String, String>> extraMetadata, WriteOperationType operationType, String schemaToStoreInCommit, String commitActionType) { HoodieCommitMetadata commitMetadata = buildMetadataFromStats(writeStats, partitionToReplaceFileIds, commitActionType, operationType); if (extraMetadata.isPresent()) { extraMetadata.get().forEach(commitMetadata::addMetadata); } commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, schemaToStoreInCommit); commitMetadata.setOperationType(operationType); return commitMetadata; }  }
CommitUtils { public static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats, Map<String, List<String>> partitionToReplaceFileIds, Option<Map<String, String>> extraMetadata, WriteOperationType operationType, String schemaToStoreInCommit, String commitActionType) { HoodieCommitMetadata commitMetadata = buildMetadataFromStats(writeStats, partitionToReplaceFileIds, commitActionType, operationType); if (extraMetadata.isPresent()) { extraMetadata.get().forEach(commitMetadata::addMetadata); } commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, schemaToStoreInCommit); commitMetadata.setOperationType(operationType); return commitMetadata; }  static String getCommitActionType(HoodieTableType tableType); static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats,
                                                   Map<String, List<String>> partitionToReplaceFileIds,
                                                   Option<Map<String, String>> extraMetadata,
                                                   WriteOperationType operationType,
                                                   String schemaToStoreInCommit,
                                                   String commitActionType); }
CommitUtils { public static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats, Map<String, List<String>> partitionToReplaceFileIds, Option<Map<String, String>> extraMetadata, WriteOperationType operationType, String schemaToStoreInCommit, String commitActionType) { HoodieCommitMetadata commitMetadata = buildMetadataFromStats(writeStats, partitionToReplaceFileIds, commitActionType, operationType); if (extraMetadata.isPresent()) { extraMetadata.get().forEach(commitMetadata::addMetadata); } commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, schemaToStoreInCommit); commitMetadata.setOperationType(operationType); return commitMetadata; }  static String getCommitActionType(HoodieTableType tableType); static HoodieCommitMetadata buildMetadata(List<HoodieWriteStat> writeStats,
                                                   Map<String, List<String>> partitionToReplaceFileIds,
                                                   Option<Map<String, String>> extraMetadata,
                                                   WriteOperationType operationType,
                                                   String schemaToStoreInCommit,
                                                   String commitActionType);  }