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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataWriteUtils.java:
##########
@@ -156,7 +160,12 @@ public static HoodieWriteConfig createMetadataWriteConfig(
         
.withKeyGenerator(HoodieTableMetadataKeyGenerator.class.getCanonicalName())
         .withPopulateMetaFields(DEFAULT_METADATA_POPULATE_META_FIELDS)
         .withWriteStatusClass(FailOnFirstErrorWriteStatus.class)
-        .withReleaseResourceEnabled(writeConfig.areReleaseResourceEnabled());
+        .withReleaseResourceEnabled(writeConfig.areReleaseResourceEnabled())
+        .withRecordMergeMode(RecordMergeMode.CUSTOM)
+        
.withRecordMergerStrategy(HoodieRecordMerger.PAYLOAD_BASED_MERGER_STRATEGY_UUDID)
+        .withPayloadConfig(HoodiePayloadConfig.newBuilder()

Review Comment:
   Why was the payload class not set before?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/SevenToEightUpgradeHandler.java:
##########
@@ -45,29 +40,6 @@ public Map<ConfigProperty, String> upgrade(HoodieWriteConfig 
config, HoodieEngin
     final HoodieTableConfig tableConfig = 
upgradeDowngradeHelper.getTable(config, 
context).getMetaClient().getTableConfig();
 
     Map<ConfigProperty, String> tablePropsToAdd = new HashMap<>();
-    if (tableConfig.getTableType().equals(HoodieTableType.MERGE_ON_READ)) {

Review Comment:
   We still need to keep the logic of adding the required table configs in 
table version 8, correct?  We should avoid the Hudi 1.0 writer to change table 
configs as much as possible, i.e., invariant table configs should either be 
created for a new table or changed during upgrade/downgrades, except for MDT 
related table configs, to avoid possible corruption.



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/io/storage/HoodieSparkIOFactory.java:
##########
@@ -51,4 +66,30 @@ public HoodieFileWriterFactory 
getWriterFactory(HoodieRecord.HoodieRecordType re
     }
     return super.getWriterFactory(recordType);
   }
+
+  @Override
+  public Function<HoodieRecord<?>, IndexedRecord> toIndexedRecord(Schema 
recordSchema, Properties properties, HoodieRecord.HoodieRecordType recordType) {

Review Comment:
   Right now, the writer side has gaps on fully supporting Spark merger.



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/io/storage/HoodieSparkIOFactory.java:
##########
@@ -51,4 +66,30 @@ public HoodieFileWriterFactory 
getWriterFactory(HoodieRecord.HoodieRecordType re
     }
     return super.getWriterFactory(recordType);
   }
+
+  @Override
+  public Function<HoodieRecord<?>, IndexedRecord> toIndexedRecord(Schema 
recordSchema, Properties properties, HoodieRecord.HoodieRecordType recordType) {

Review Comment:
   I'm wondering if we can further separate the read and write paths that use 
the merge API to use different merger for now.  For the write path that still 
uses writer expecting Avro records (e.g., Avro parquet writer), we still use 
Avro-based merger; for read path that expects engine-record, i.e., 
InternalRow/Row in Spark, the Internal Row should be used for merging.  In Hudi 
1.1, we can reduce the complexity.



##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/util/JavaScalaUtils.scala:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util
+
+object JavaScalaUtils {

Review Comment:
   Put these into `JavaScalaConverters`.



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