pvary commented on code in PR #14500:
URL: https://github.com/apache/iceberg/pull/14500#discussion_r2717779541


##########
api/src/main/java/org/apache/iceberg/types/Comparators.java:
##########
@@ -251,6 +251,24 @@ public static Comparator<UUID> signedUUIDs() {
     return Comparator.naturalOrder();
   }
 
+  /**
+   * Returns the given comparator for a type or the signed UUID comparator, 
conditionally.
+   *
+   * @param type the Iceberg type
+   * @param defaultComparator the default comparator to use for non-UUID types 
or when signed UUID
+   *     comparison is not requested
+   * @param useSignedUuid if true and the type is UUID, returns a signed UUID 
comparator
+   * @return the appropriate comparator
+   */
+  @SuppressWarnings("unchecked")
+  public static <T> Comparator<T> comparatorFor(
+      Type type, Comparator<T> defaultComparator, boolean useSignedUuid) {
+    if (useSignedUuid && type.typeId() == Type.TypeID.UUID) {
+      return (Comparator<T>) signedUUIDs();
+    }
+    return defaultComparator;

Review Comment:
   nit: newline before the `return`



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to