linliu-code commented on code in PR #12384:
URL: https://github.com/apache/hudi/pull/12384#discussion_r1864740303
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/HoodieCompactor.java:
##########
@@ -189,26 +218,58 @@ public List<WriteStatus> compact(HoodieCompactionHandler
compactionHandler,
new StoragePath(FSUtils.constructAbsolutePath(
metaClient.getBasePath(), operation.getPartitionPath()),
p).toString())
.collect(toList());
- HoodieMergedLogRecordScanner scanner =
HoodieMergedLogRecordScanner.newBuilder()
- .withStorage(storage)
- .withBasePath(metaClient.getBasePath())
- .withLogFilePaths(logFiles)
- .withReaderSchema(readerSchema)
-
.withLatestInstantTime(executionHelper.instantTimeToUseForScanning(instantTime,
maxInstantTime))
- .withInstantRange(instantRange)
-
.withInternalSchema(internalSchemaOption.orElse(InternalSchema.getEmptyInternalSchema()))
- .withMaxMemorySizeInBytes(maxMemoryPerCompaction)
- .withReverseReader(config.getCompactionReverseLogReadEnabled())
- .withBufferSize(config.getMaxDFSStreamBufferSize())
- .withSpillableMapBasePath(config.getSpillableMapBasePath())
- .withDiskMapType(config.getCommonConfig().getSpillableDiskMapType())
-
.withBitCaskDiskMapCompressionEnabled(config.getCommonConfig().isBitCaskDiskMapCompressionEnabled())
- .withOperationField(config.allowOperationMetadataField())
- .withPartition(operation.getPartitionPath())
-
.withOptimizedLogBlocksScan(executionHelper.enableOptimizedLogBlockScan(config))
- .withRecordMerger(config.getRecordMerger())
- .withTableMetaClient(metaClient)
+
+ boolean isPartialUpdateEnabled =
config.getBooleanOrDefault("hoodie.spark.sql.merge.into.partial.updates",
false);
+ if (isPartialUpdateEnabled && broadcastManagerOpt.isPresent() &&
!isMetadataTable(metaClient)) {
+ return compactUsingFileGroupReader(
+ logFiles, readerSchema, instantTime, internalSchemaOption, config,
operation, metaClient, broadcastManagerOpt, taskContextSupplier);
+ } else {
+ return compactUsingLegacyMethod(
+ storage, logFiles, readerSchema, executionHelper, instantTime,
maxInstantTime, instantRange, internalSchemaOption, config,
+ maxMemoryPerCompaction, operation, metaClient, compactionHandler);
+ }
+ }
+
+ private List<WriteStatus> compactUsingFileGroupReader(List<String> logFiles,
Schema readerSchema, String instantTime,
+ Option<InternalSchema>
internalSchemaOption, HoodieWriteConfig config,
+ CompactionOperation
operation, HoodieTableMetaClient metaClient,
+
Option<CompactorBroadcastManager> partialUpdateReaderContextOpt,
+ TaskContextSupplier
taskContextSupplier) throws IOException {
+ CompactorBroadcastManager compactorBroadcastManager =
partialUpdateReaderContextOpt.get();
+ // PATH 1: When the engine decides to return a valid reader context object.
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]