wuwenchi commented on code in PR #6320:
URL: https://github.com/apache/hudi/pull/6320#discussion_r941011658


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableFactory.java:
##########
@@ -235,6 +235,11 @@ private static void setupHoodieKeyOptions(Configuration 
conf, CatalogTable table
       conf.setString(FlinkOptions.KEYGEN_CLASS_NAME, 
ComplexAvroKeyGenerator.class.getName());
       LOG.info("Table option [{}] is reset to {} because record key or 
partition path has two or more fields",
           FlinkOptions.KEYGEN_CLASS_NAME.key(), 
ComplexAvroKeyGenerator.class.getName());
+    } else if (!conf.getOptional(FlinkOptions.KEYGEN_CLASS_NAME).isPresent()) {
+      String keyGenName = FlinkOptions.getKeyGenClassNameByType(conf);
+      conf.setString(FlinkOptions.KEYGEN_CLASS_NAME, keyGenName);
+      LOG.info("Table option [{}] is reset to {} because of {}",
+          FlinkOptions.KEYGEN_CLASS_NAME.key(), keyGenName, 
FlinkOptions.KEYGEN_TYPE);

Review Comment:
   Do you mean StreamerUtil line 318?
   like :
   
   ```java
       String keyGeneratorClassName = 
conf.getString(FlinkOptions.KEYGEN_CLASS_NAME);
       if (keyGeneratorClassName == null) {
         keyGeneratorClassName = FlinkOptions.getKeyGenClassNameByType(conf);
       }
   
       HoodieTableMetaClient metaClient = 
HoodieTableMetaClient.withPropertyBuilder()
            .setKeyGeneratorClassProp(keyGeneratorClassName)
   ```



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