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


##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -1595,6 +1605,16 @@ public Properties build() {
         KeyGeneratorType type = KeyGeneratorType.valueOf(keyGeneratorType);
         tableConfig.setValue(HoodieTableConfig.KEY_GENERATOR_TYPE, 
type.name());
       }
+      if (tableConfig.isComplexKeyGenWithSingleRecordKeyField() && 
metaFieldsMode.isRecordKeyPopulated()) {
+        // New tables store `<field>:<value>` keys. Only releases up to 1.0.2 
(table version 8 and below) ever
+        // wrote bare values, so that encoding can only be declared for a 
table created at such a version.
+        ComplexKeyGenEncoding encoding = complexKeyGenEncoding != null ? 
complexKeyGenEncoding : ComplexKeyGenEncoding.FIELD_PREFIXED;
+        checkArgument(encoding == ComplexKeyGenEncoding.FIELD_PREFIXED || 
tableVersion.lesserThan(HoodieTableVersion.NINE),
+            String.format("%s=%s is only valid for a table created at version 
%s or below; tables at version %s and above "

Review Comment:
   New tables created at v9 should always use FIELD_PREFIXED.



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