rubenada commented on code in PR #5393:
URL: https://github.com/apache/calcite/pull/5393#discussion_r4495594111


##########
core/src/main/java/org/apache/calcite/runtime/Utilities.java:
##########
@@ -261,6 +263,39 @@ public static int compareNullsLastForMergeJoin(@Nullable 
Comparable v0, @Nullabl
     return EnumerableDefaults.compareNullsLastForMergeJoin(v0, v1, comparator);
   }
 
+  /** Compares two non-null ROW, ARRAY, MULTISET or MAP values element-wise. */
+  public static int compareComposite(Object v0, Object v1) {
+    return Functions.compareListItems(v0, v1);
+  }
+
+  /** Compares two ROW, ARRAY, MULTISET or MAP values element-wise, nulls 
first. */
+  public static int compareCompositeNullsFirst(@Nullable Object v0, @Nullable 
Object v1) {
+    return v0 == v1 ? 0
+        : v0 == null ? -1
+            : v1 == null ? 1
+                : Functions.compareListItems(v0, v1);
+  }
+
+  /** Compares two ROW, ARRAY, MULTISET or MAP values element-wise, nulls 
last. */
+  public static int compareCompositeNullsLast(@Nullable Object v0, @Nullable 
Object v1) {
+    return Functions.compareListItems(v0, v1);
+  }
+
+  /** Merge join variant of {@link #compareCompositeNullsLast}: throws if both
+   * values are null, so that merge join does not match two null keys. */
+  public static int compareCompositeNullsLastForMergeJoin(@Nullable Object v0,
+      @Nullable Object v1) {
+    return compareCompositeNullsLastForMergeJoin(v0, v1, null);
+  }
+
+  /** ROW variant that also rejects equal keys containing NULL fields.
+   * The generated predicate descends into ROW fields, but not collection 
elements. */
+  public static int compareCompositeNullsLastForMergeJoin(@Nullable Object v0,
+      @Nullable Object v1, Predicate1<Object> containsNull) {

Review Comment:
   I think the CheckerFramework error should go away by declaring `@Nullable 
Predicate1<Object> containsNull`



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