the-other-tim-brown commented on code in PR #13208:
URL: https://github.com/apache/hudi/pull/13208#discussion_r2060305608


##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieReaderContext.java:
##########
@@ -244,8 +253,25 @@ public boolean castToBoolean(Object value) {
    * @return The record key in String.
    */
   public String getRecordKey(T record, Schema schema) {
-    Object val = getValue(record, schema, RECORD_KEY_METADATA_FIELD);
-    return val.toString();
+    return recordKeyExtractor.apply(record, schema);
+  }
+
+  private BiFunction<T, Schema, String> metadataKeyExtractor() {
+    return (record, schema) -> getValue(record, schema, 
RECORD_KEY_METADATA_FIELD).toString();
+  }
+
+  private BiFunction<T, Schema, String> virtualKeyExtractor(String[] 
recordKeyFields) {
+    return (record, schema) -> {
+      BiFunction<String, Integer, String> valueFunction = (recordKeyField, 
index) -> {
+        try {
+          Object result = getValue(record, schema, recordKeyField);
+          return result != null ? result.toString() : null;
+        } catch (HoodieException e) {
+          throw new HoodieKeyException("Record key field '" + recordKeyField + 
"' does not exist in the input record");

Review Comment:
   This was leftover from some old code copied from the key gen utils, cleaning 
it up now



-- 
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]

Reply via email to