yihua commented on code in PR #13650:
URL: https://github.com/apache/hudi/pull/13650#discussion_r2299507567
##########
hudi-common/src/main/java/org/apache/hudi/common/engine/RecordContext.java:
##########
@@ -335,6 +336,15 @@ private SerializableBiFunction<T, Schema, String>
metadataKeyExtractor() {
}
private SerializableBiFunction<T, Schema, String>
virtualKeyExtractor(String[] recordKeyFields) {
+ if (recordKeyFields.length == 1) {
+ return (record, schema) -> {
+ Object result = getValue(record, schema, recordKeyFields[0]);
+ if (result == null) {
+ throw new HoodieKeyException("recordKey cannot be null");
+ }
+ return result.toString();
Review Comment:
Given that this is for virtual keys which are generated on the fly (not
persisted on storage), it's OK to use one key format for merging (if this
assumption is incorrect, we need to use
`COMPLEX_KEYGEN_ENCODE_SINGLE_RECORD_KEY_FIELD_NAME` for diverging logic of
virtual key generation). The main difference compared to multiple record key
fields is that the record key cannot be null, thus the logic.
--
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]