yihua commented on code in PR #11816:
URL: https://github.com/apache/hudi/pull/11816#discussion_r1764083620
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java:
##########
@@ -65,30 +65,35 @@ public class KeyGenUtils {
*/
public static KeyGeneratorType inferKeyGeneratorType(
Option<String> recordsKeyFields, String partitionFields) {
- boolean autoGenerateRecordKeys = !recordsKeyFields.isPresent();
- if (autoGenerateRecordKeys) {
- return inferKeyGeneratorTypeForAutoKeyGen(partitionFields);
+ int numRecordKeyFields = recordsKeyFields.map(fields ->
fields.split(",").length).orElse(0);
+ KeyGeneratorType partitionKeyGeneratorType =
inferKeyGeneratorTypeFromPartitionFields(partitionFields);
Review Comment:
I think a better approach is to take both `recordsKeyFields` and
`partitionFields` and infer the keygen type based on both `numRecordKeyFields`
and `numPartitionFields` so it's more clear. @lokeshj1703 You can take this in
a follow-up PR and fix all places where `autoGenerateRecordKeys` is checked.
--
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]