danny0405 commented on code in PR #20368:
URL: https://github.com/apache/hudi/pull/20368#discussion_r4321315468


##########
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:
   guess we might need to add a new getFieldValueFromInternalRowInternal that 
pass around the StructType and HoodieUnsafeRowUtils.NestedFieldPath directly so 
that we can eliminate the repetitive calls completely.



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