From 25bbff64cf9bb05adda36af4d830abd81655a2d7 Mon Sep 17 00:00:00 2001 From: Danny Chan Date: Wed, 15 Jun 2022 08:48:13 +0800 Subject: [PATCH] [minor] Following HUDI-4207, remote the new wrapper #init method (#5865) --- .../org/apache/hudi/io/HoodieMergeHandle.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java index 4d6427880..a85df2a23 100644 --- a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java +++ b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java @@ -118,14 +118,16 @@ public class HoodieMergeHandle extends H Iterator> recordItr, String partitionPath, String fileId, TaskContextSupplier taskContextSupplier, Option keyGeneratorOpt) { this(config, instantTime, hoodieTable, recordItr, partitionPath, fileId, taskContextSupplier, - getLatestBaseFile(hoodieTable, partitionPath, fileId), keyGeneratorOpt); + getLatestBaseFile(hoodieTable, partitionPath, fileId), keyGeneratorOpt); } public HoodieMergeHandle(HoodieWriteConfig config, String instantTime, HoodieTable hoodieTable, Iterator> recordItr, String partitionPath, String fileId, TaskContextSupplier taskContextSupplier, HoodieBaseFile baseFile, Option keyGeneratorOpt) { super(config, instantTime, partitionPath, fileId, hoodieTable, taskContextSupplier); - init(recordItr, baseFile, keyGeneratorOpt); + init(fileId, recordItr); + init(fileId, partitionPath, baseFile); + validateAndSetAndKeyGenProps(keyGeneratorOpt, config.populateMetaFields()); } /** @@ -138,7 +140,8 @@ public class HoodieMergeHandle extends H this.keyToNewRecords = keyToNewRecords; this.useWriterSchemaForCompaction = true; this.preserveMetadata = config.isPreserveHoodieCommitMetadataForCompaction(); - init(null, dataFileToBeMerged, keyGeneratorOpt); + init(fileId, this.partitionPath, dataFileToBeMerged); + validateAndSetAndKeyGenProps(keyGeneratorOpt, config.populateMetaFields()); } private void validateAndSetAndKeyGenProps(Option keyGeneratorOpt, boolean populateMetaFields) { @@ -146,14 +149,6 @@ public class HoodieMergeHandle extends H this.keyGeneratorOpt = keyGeneratorOpt; } - private void init(Iterator> recordItr, HoodieBaseFile baseFile, Option keyGeneratorOpt) { - if (recordItr != null) { - init(this.fileId, recordItr); - } - init(this.fileId, this.partitionPath, baseFile); - validateAndSetAndKeyGenProps(keyGeneratorOpt, this.config.populateMetaFields()); - } - public static HoodieBaseFile getLatestBaseFile(HoodieTable hoodieTable, String partitionPath, String fileId) { Option baseFileOp = hoodieTable.getBaseFileOnlyView().getLatestBaseFile(partitionPath, fileId); if (!baseFileOp.isPresent()) {