linliu-code commented on code in PR #17834:
URL: https://github.com/apache/hudi/pull/17834#discussion_r2762098168


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java:
##########
@@ -272,4 +276,30 @@ public static boolean 
isAutoGeneratedRecordKeysEnabled(TypedProperties props) {
         || 
props.getProperty(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()).equals(StringUtils.EMPTY_STRING);
     // spark-sql sets record key config to empty string for update, and couple 
of other statements.
   }
+
+  public static boolean 
isComplexKeyGeneratorWithSingleRecordKeyField(HoodieTableConfig tableConfig) {
+    Option<String[]> recordKeyFields = tableConfig.getRecordKeyFields();
+    return KeyGeneratorType.isComplexKeyGenerator(tableConfig)
+        && recordKeyFields.isPresent() && recordKeyFields.get().length == 1;
+  }
+
+  public static String getComplexKeygenErrorMessage(String operation) {
+    return "This table uses the complex key generator with a single record "
+        + "key field. If the table is written with Hudi 0.14.1, 0.15.0, 1.0.0, 
1.0.1, or 1.0.2 "
+        + "release before, the table may potentially contain duplicates due to 
a breaking "
+        + "change in the key encoding in the _hoodie_record_key meta field 
(HUDI-7001) which "
+        + "is crucial for upserts. Please take action based on the details on 
the deployment "
+        + "guide 
(https://hudi.apache.org/docs/deployment#complex-key-generator) "
+        + "before resuming the " + operation + " to the this table. If you're 
certain "

Review Comment:
   "the this table" -> "the table"



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