yihua commented on code in PR #20844:
URL: https://github.com/apache/hudi/pull/20844#discussion_r4702874240


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/others/TestMergeIntoTable.scala:
##########
@@ -474,6 +474,69 @@ class TestMergeIntoTable extends HoodieSparkSqlTestBase 
with ScalaAssertionSuppo
     }
   }
 
+  test("Test MergeInto with global index into a small file group of a MOR 
table") {

Review Comment:
   Fixed, `HoodieWriteMergeHandle` had it too, and both tests now run with both 
merge handles.



##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/BufferedRecordMergerFactory.java:
##########
@@ -384,13 +386,26 @@ public Option<BufferedRecord<T>> 
deltaMergeRecords(BufferedRecord<T> newRecord,
    */
   private static class ExpressionPayloadRecordMerger<T> extends 
CustomPayloadRecordMerger<T> {
     private final HoodieRecordMerger deltaMerger;
+    private Integer mergedRecordSchemaId;
 
     public ExpressionPayloadRecordMerger(RecordContext<T> recordContext, 
Option<HoodieRecordMerger> recordMerger, String incomingPayloadClass,
                                          HoodieSchema readerSchema, 
TypedProperties props) {
       super(recordContext, recordMerger, incomingPayloadClass, readerSchema, 
props);
       this.deltaMerger = 
HoodieRecordUtils.mergerToPreCombineMode(recordMerger.get());
     }
 
+    @Override
+    public BufferedRecord<T> finalMerge(BufferedRecord<T> olderRecord, 
BufferedRecord<T> newerRecord) throws IOException {
+      if (mergedRecordSchemaId == null) {
+        mergedRecordSchemaId = 
recordContext.encodeSchema(HoodieSchemaCache.intern(HoodieSchemaUtils.removeMetadataFields(readerSchema)));

Review Comment:
   Done, the loader now sets the merged-record schema once on the schema 
handler, and the merger and the update processor read it from there, so a 
merger built elsewhere never takes that branch.



-- 
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]

Reply via email to