TheR1sing3un commented on code in PR #13526:
URL: https://github.com/apache/hudi/pull/13526#discussion_r2199372741


##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieReaderContext.java:
##########
@@ -385,21 +386,24 @@ private BiFunction<T, Schema, String> 
virtualKeyExtractor(String[] recordKeyFiel
   /**
    * Gets the ordering value in particular type.
    *
-   * @param record An option of record.
-   * @param schema The Avro schema of the record.
-   * @param orderingFieldName name of the ordering field
+   * @param record             An option of record.
+   * @param schema             The Avro schema of the record.
+   * @param orderingFieldNames name of the ordering field
    * @return The ordering value.
    */
   public Comparable getOrderingValue(T record,
                                      Schema schema,
-                                     Option<String> orderingFieldName) {
-    if (orderingFieldName.isEmpty()) {
-      return DEFAULT_ORDERING_VALUE;
+                                     Option<List<String>> orderingFieldNames) {
+    if (orderingFieldNames.isEmpty()) {
+      return Comparables.getDefault();
     }
 
-    Object value = getValue(record, schema, orderingFieldName.get());
-    Comparable finalOrderingVal = value != null ? 
convertValueToEngineType((Comparable) value) : DEFAULT_ORDERING_VALUE;
-    return finalOrderingVal;
+    return new Comparables(
+        orderingFieldNames.get().stream().map(field -> {
+          Object value = getValue(record, schema, field);
+          // API getDefaultOrderingValue is only used inside Comparables 
constructor

Review Comment:
   Let's pay attention to the performance issue in this method that every 
record passes through. How about using a fixed-size list with 
`ArrayList(orderingFieldNames.size())` instead?



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