flashJd commented on code in PR #6385:
URL: https://github.com/apache/hudi/pull/6385#discussion_r948604910
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java:
##########
@@ -73,21 +73,20 @@ public static String
getPartitionPathFromGenericRecord(GenericRecord genericReco
*/
public static String[] extractRecordKeys(String recordKey) {
String[] fieldKV = recordKey.split(",");
- if (fieldKV.length == 1) {
- return fieldKV;
- } else {
- // a complex key
- return Arrays.stream(fieldKV).map(kv -> {
- final String[] kvArray = kv.split(":");
- if (kvArray[1].equals(NULL_RECORDKEY_PLACEHOLDER)) {
- return null;
- } else if (kvArray[1].equals(EMPTY_RECORDKEY_PLACEHOLDER)) {
- return "";
- } else {
- return kvArray[1];
- }
- }).toArray(String[]::new);
- }
+
+ return Arrays.stream(fieldKV).map(kv -> {
+ final String[] kvArray = kv.split(":");
Review Comment:
> So why we configure a `COMPLEX` key generator while the key is just simple
here?
Because flink-sql's default logic is COMPLEX KeyGenerator, when boolean
complexHoodieKey = pks.length > 1 || partitions.length > 1;
https://github.com/apache/hudi/blob/master/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableFactory.java#L239
--
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]