linliu-code commented on code in PR #17834:
URL: https://github.com/apache/hudi/pull/17834#discussion_r2762093752
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/keygen/BuiltinKeyGenerator.java:
##########
@@ -233,23 +235,43 @@ private <S> S combineRecordKeyInternal(
}
private <S> S combineCompositeRecordKeyInternal(
+ boolean encodeSingleKeyFieldName,
Supplier<PartitionPathFormatterBase.StringBuilder<S>> builderFactory,
Function<Object, S> converter,
Function<S, S> emptyKeyPartHandler,
Predicate<S> isNullOrEmptyKeyPartPredicate,
Object... recordKeyParts
) {
- boolean hasNonNullNonEmptyPart = false;
+ if (recordKeyParts.length == 0) {
+ throw new HoodieKeyException(String.format("All of the values for (%s)
were either null or empty", recordKeyFields));
+ }
PartitionPathFormatterBase.StringBuilder<S> sb = builderFactory.get();
+
+ if (recordKeyParts.length == 1) {
+ // NOTE: If record-key part has already been a string [[toString]] will
be a no-op
+ S convertedKeyPart =
emptyKeyPartHandler.apply(converter.apply(recordKeyParts[0]));
+
+ if (encodeSingleKeyFieldName) {
+ sb.appendJava(recordKeyFields.get(0));
+ sb.appendJava(DEFAULT_COMPOSITE_KEY_FILED_VALUE);
Review Comment:
nit: FILED -> FIELD
--
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]