linliu-code commented on code in PR #11934:
URL: https://github.com/apache/hudi/pull/11934#discussion_r1774170590
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java:
##########
@@ -153,7 +154,12 @@ public static String getRecordKey(GenericRecord record,
List<String> recordKeyFi
StringBuilder recordKey = new StringBuilder();
for (int i = 0; i < recordKeyFields.size(); i++) {
String recordKeyField = recordKeyFields.get(i);
- String recordKeyValue =
HoodieAvroUtils.getNestedFieldValAsString(record, recordKeyField, true,
consistentLogicalTimestampEnabled);
+ String recordKeyValue;
+ try {
+ recordKeyValue = HoodieAvroUtils.getNestedFieldValAsString(record,
recordKeyField, false, consistentLogicalTimestampEnabled);
+ } catch (HoodieException e) {
+ throw new HoodieKeyException("Record key field '" + recordKeyField +
"' does not exist in the input record");
Review Comment:
Which one is the standard way to concatenate strings in Hudi? "+" or
"String.format()?
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java:
##########
@@ -153,7 +154,12 @@ public static String getRecordKey(GenericRecord record,
List<String> recordKeyFi
StringBuilder recordKey = new StringBuilder();
for (int i = 0; i < recordKeyFields.size(); i++) {
String recordKeyField = recordKeyFields.get(i);
- String recordKeyValue =
HoodieAvroUtils.getNestedFieldValAsString(record, recordKeyField, true,
consistentLogicalTimestampEnabled);
+ String recordKeyValue;
+ try {
+ recordKeyValue = HoodieAvroUtils.getNestedFieldValAsString(record,
recordKeyField, false, consistentLogicalTimestampEnabled);
+ } catch (HoodieException e) {
+ throw new HoodieKeyException("Record key field '" + recordKeyField +
"' does not exist in the input record");
Review Comment:
Which one is the standard way to concatenate strings in Hudi? "+" or
"String.format()"?
--
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]