hudi-agent commented on code in PR #20276:
URL: https://github.com/apache/hudi/pull/20276#discussion_r4235356522
##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java:
##########
@@ -701,12 +701,30 @@ public static void create(HoodieStorage storage,
StoragePath metadataFolder, Pro
hoodieConfig.setValue(POPULATE_META_FIELDS,
Boolean.toString(metaFieldsMode.toLegacyPopulateMetaFields()));
}
+ getMissingKeyGeneratorClass(hoodieConfig).ifPresent(
+ keyGeneratorClass -> hoodieConfig.setValue(KEY_GENERATOR_CLASS_NAME,
keyGeneratorClass));
dropInvalidConfigs(hoodieConfig);
storeProperties(hoodieConfig.getProps(), outputStream, propertyPath);
}
}
+ /**
+ * Returns the key generator class that a table below version 8 records only
through its key generator type.
+ * Hudi 0.x reads only the class, so such a table must carry it as well.
+ */
+ public static Option<String> getMissingKeyGeneratorClass(HoodieConfig
config) {
+ if (!getTableVersion(config).lesserThan(HoodieTableVersion.EIGHT)
Review Comment:
🤖 nit: could you split this compound negated condition into a named local,
e.g. `boolean isBelowVersionEight =
getTableVersion(config).lesserThan(HoodieTableVersion.EIGHT);`, and return
early on `!isBelowVersionEight`? `!x.lesserThan(...) || contains || !contains`
is hard to read at a glance.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]