linliu-code commented on code in PR #13656:
URL: https://github.com/apache/hudi/pull/13656#discussion_r2248327837
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -1551,9 +1551,17 @@ public Properties build() {
tableConfig.setValue(HoodieTableConfig.POPULATE_META_FIELDS,
Boolean.toString(populateMetaFields));
}
if (null != keyGeneratorClassProp) {
- tableConfig.setValue(HoodieTableConfig.KEY_GENERATOR_TYPE,
KeyGeneratorType.fromClassName(keyGeneratorClassProp).name());
+ KeyGeneratorType type =
KeyGeneratorType.fromClassName(keyGeneratorClassProp);
+ tableConfig.setValue(HoodieTableConfig.KEY_GENERATOR_TYPE,
type.name());
+ // For USER_PROVIDED type, key generator class is recorded as well.
+ if (type == KeyGeneratorType.USER_PROVIDED) {
+ tableConfig.setValue(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME,
keyGeneratorClassProp);
+ }
} else if (null != keyGeneratorType) {
tableConfig.setValue(HoodieTableConfig.KEY_GENERATOR_TYPE,
keyGeneratorType);
+
checkArgument(!keyGeneratorType.equals(KeyGeneratorType.USER_PROVIDED.name()),
+ String.format("When key generator type is %s, the key generator
class must be set properly",
Review Comment:
Based on my discuss with @yihua , we only needed to set class when
KEY_GENERATOR_TYPE == USER_PROVIDED. Agreed that we can simply require type and
class at the same time. both works. Will change.
--
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]