nsivabalan commented on a change in pull request #4077:
URL: https://github.com/apache/hudi/pull/4077#discussion_r754782510



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/TwoToThreeUpgradeHandler.java
##########
@@ -40,10 +42,14 @@
       // table has been updated and is not backward compatible.
       HoodieTableMetadataUtil.deleteMetadataTable(config.getBasePath(), 
context);
     }
-    Map<ConfigProperty, String> tablePropsToAdd = new HashMap<>();
+    Map<ConfigProperty, String> tablePropsToAdd = new Hashtable<>();
     tablePropsToAdd.put(HoodieTableConfig.URL_ENCODE_PARTITIONING, 
config.getStringOrDefault(HoodieTableConfig.URL_ENCODE_PARTITIONING));
     tablePropsToAdd.put(HoodieTableConfig.HIVE_STYLE_PARTITIONING_ENABLE, 
config.getStringOrDefault(HoodieTableConfig.HIVE_STYLE_PARTITIONING_ENABLE));
-    tablePropsToAdd.put(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME, 
config.getString(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME));
+    String keyGenClassName = 
Option.ofNullable(config.getString(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME))
+        .orElse(config.getString(HoodieWriteConfig.KEYGENERATOR_CLASS_NAME));
+    ValidationUtils.checkState(keyGenClassName != null, String.format("Missing 
config: %s or %s",
+            HoodieTableConfig.KEY_GENERATOR_CLASS_NAME, 
HoodieWriteConfig.KEYGENERATOR_CLASS_NAME));
+    tablePropsToAdd.put(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME, 
keyGenClassName);

Review comment:
       Can you fix the test to validate that this property is present after 
upgrade. 




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