lokeshj1703 commented on code in PR #13600:
URL: https://github.com/apache/hudi/pull/13600#discussion_r2234090913
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -492,10 +542,34 @@ public static <R> HoodieData<HoodieRecord<R>>
mergeForPartitionUpdatesIfNeeded(
.filter(p -> p.getRight().isPresent())
.map(p -> Pair.of(p.getRight().get().getPartitionPath(),
p.getRight().get().getFileId()))
.distinct(updatedConfig.getGlobalIndexReconcileParallelism());
+ // define the buffered record merger.
+ ReaderContextFactory<R> readerContextFactory = (ReaderContextFactory<R>)
hoodieTable.getContext()
+ .<R>getReaderContextFactoryDuringWrite(hoodieTable.getMetaClient(),
config.getRecordMerger().getRecordType());
+ HoodieReaderContext<R> readerContext = readerContextFactory.getContext();
// merged existing records with current locations being set
- HoodieData<HoodieRecord<R>> existingRecords =
getExistingRecords(globalLocations, keyGeneratorWriteConfigOpt.getLeft(),
hoodieTable);
-
- final HoodieRecordMerger recordMerger = updatedConfig.getRecordMerger();
+ HoodieData<HoodieRecord<R>> existingRecords =
+ getExistingRecords(globalLocations,
keyGeneratorWriteConfigOpt.getLeft(), hoodieTable, readerContextFactory);
+ List<String> orderingFieldNames = getOrderingFieldName(
+ readerContext, hoodieTable.getConfig().getProps(),
hoodieTable.getMetaClient());
+ BufferedRecordMerger<R> recordMerger = BufferedRecordMergerFactory.create(
+ readerContext,
+ hoodieTable.getConfig().getRecordMergeMode(),
+ false,
+ Option.ofNullable(hoodieTable.getConfig().getRecordMerger()),
+ orderingFieldNames,
+ Option.ofNullable(hoodieTable.getConfig().getPayloadClass()),
+ new SerializableSchema(hoodieTable.getConfig().getSchema()).get(),
+ hoodieTable.getConfig().getProps(),
+ hoodieTable.getMetaClient().getTableConfig().getPartialUpdateMode());
+ RecordContext recordContext = readerContext.getRecordContext();
+ // Due to new records we cant use meta fields for record key extraction
+
recordContext.updateRecordKeyExtractor(hoodieTable.getMetaClient().getTableConfig(),
false);
Review Comment:
Can not use meta fields for record keys since there are new records
--
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]