wombatu-kun commented on code in PR #20368:
URL: https://github.com/apache/hudi/pull/20368#discussion_r4325471107


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/common/model/HoodieSparkRecord.java:
##########
@@ -392,10 +392,12 @@ public Comparable<?> getOrderingValueAsJava(HoodieSchema 
recordSchema, Propertie
       StructType structType = 
HoodieInternalRowUtils.getCachedSchema(recordSchema);
       return OrderingValues.create(orderingFields, field -> {
         // Ordering fields can be nested, so resolve them by path as 
doGetOrderingValue does.
-        if (HoodieInternalRowUtils.getCachedPosList(structType, 
field).isEmpty()) {
+        scala.Option<NestedFieldPath> cachedNestedFieldPath =
+            HoodieInternalRowUtils.getCachedPosList(structType, field);
+        if (cachedNestedFieldPath.isEmpty()) {
           return OrderingValues.getDefault();
         }
-        return (Comparable<?>) getColumnValueAsJava(recordSchema, field, 
props);
+        return (Comparable<?>) getFieldValueFromInternalRowAsJava(data, 
cachedNestedFieldPath.get());

Review Comment:
   Done 648342b7c02e. Per row, `getOrderingValueAsJava` resolves the 
`StructType` once and each field's `NestedFieldPath` once, and reads the value 
through the new `getFieldValueFromInternalRowInternal(InternalRow, 
NestedFieldPath, boolean)`, which the name-based lookup now shares; it takes no 
`StructType`, since the path already carries each field's type.



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