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


##########
hudi-common/src/main/java/org/apache/hudi/common/util/OrderingValues.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.common.util;
+
+import org.apache.hudi.common.model.EmptyOrderingValue;
+import org.apache.hudi.common.model.MultipleFieldsOrderingValue;
+import org.apache.hudi.common.model.OrderingValue;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+
+/**
+ * Factory class for {@link org.apache.hudi.common.model.OrderingValue}.
+ */
+public class OrderingValues {
+  private static final Comparable<?> DEFAULT_VALUE = 
org.apache.hudi.common.model.HoodieRecord.DEFAULT_ORDERING_VALUE;
+
+  /**
+   * Creates an {@code OrderingValue} with given values.
+   *
+   * <p>CAUTION: if the values are fetched through ordering fields,
+   * please use {@link #create(List, Function)} or {@link #create(String[], 
Function)}
+   * as much as possible to avoid streaming on the ordering fields in row 
level.</p>
+   */
+  public static Comparable create(Comparable[] orderingValues) {
+    if (orderingValues.length == 1) {
+      return orderingValues[0];

Review Comment:
   Thanks for the explanation, I am not strongly opinionated about either 
approach so was curious what you found when trying it out. I'm guessing we 
would have to make even more changes to plug that interface everywhere we use 
comparable today so makes sense to try to keep the change to a minimum here.



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