the-other-tim-brown commented on code in PR #13600:
URL: https://github.com/apache/hudi/pull/13600#discussion_r2234124822
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -444,27 +461,57 @@ private static <R> Option<HoodieRecord<R>>
mergeIncomingWithExistingRecord(
HoodieRecord<R> existing,
Schema writeSchema,
HoodieWriteConfig config,
- HoodieRecordMerger recordMerger,
- Option<BaseKeyGenerator> expressionPayloadKeygen) throws IOException {
+ BufferedRecordMerger<R> recordMerger,
+ Option<BaseKeyGenerator> expressionPayloadKeygen,
+ RecordContext<R> recordContext,
+ List<String> orderingFieldNames,
+ boolean hasBuiltInDelete,
+ Option<Pair<String, String>> customDeleteMarkerKeyValue,
+ int hoodieOperationPos,
+ KeyGenerator keyGenerator) throws IOException {
Schema existingSchema = HoodieAvroUtils.addMetadataFields(new
Schema.Parser().parse(config.getSchema()),
config.allowOperationMetadataField());
Schema writeSchemaWithMetaFields =
HoodieAvroUtils.addMetadataFields(writeSchema,
config.allowOperationMetadataField());
if (expressionPayloadKeygen.isPresent()) {
- return mergeIncomingWithExistingRecordWithExpressionPayload(incoming,
existing, writeSchema,
- existingSchema, writeSchemaWithMetaFields, config, recordMerger,
expressionPayloadKeygen.get());
+ HoodieRecord newRecord = incoming;
+ HoodieRecord oldRecord = existing;
+ if (recordContext instanceof AvroRecordContext) {
+ // We need to convert HoodieAvroRecord to HoodieAvroIndexedRecord in
order to use the reader context
+ newRecord = incoming.toIndexedRecord(writeSchema,
config.getProps()).get();
+ oldRecord = existing.toIndexedRecord(writeSchema,
config.getProps()).get();
Review Comment:
You shouldn't need to do a conversion. The reader and record context take in
a type, that type should ensure they match.
--
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]