danny0405 commented on code in PR #13699:
URL: https://github.com/apache/hudi/pull/13699#discussion_r2265607160
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/FileGroupReaderBasedMergeHandle.java:
##########
@@ -251,6 +353,30 @@ public List<WriteStatus> close() {
}
}
+ private Option<BaseFileUpdateCallback<T>> createCallback() {
+ List<BaseFileUpdateCallback<T>> callbacks = new ArrayList<>();
+ // Handle CDC workflow.
+ if (cdcLogger.isPresent()) {
+ callbacks.add(new CDCCallback<>(cdcLogger.get(), readerContext));
+ }
+ // record index callback
+ recordIndexCallbackOpt.ifPresent(callbacks::add);
+ // Stream secondary index stats.
+ if (isSecondaryIndexStatsStreamingWritesEnabled) {
+ this.secondaryIndexCallbackOpt = Option.of(new SecondaryIndexCallback<>(
+ partitionPath,
+ writeSchemaWithMetaFields,
+ readerContext,
+ writeStatus,
+ secondaryIndexDefns
+ ));
+ } else {
+ this.secondaryIndexCallbackOpt = Option.empty();
+ }
+ secondaryIndexCallbackOpt.ifPresent(callbacks::add);
+ return callbacks.isEmpty() ? Option.empty() :
Option.of(CompositeCallback.of(callbacks));
Review Comment:
all the callbacks can be initialzied as local variables, there is no need to
use `CompositeCallback` when the callbacks is single.
--
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]