You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "tanclary (via GitHub)" <gi...@apache.org> on 2023/06/16 18:05:46 UTC

[GitHub] [calcite] tanclary commented on a diff in pull request #3263: [CALCITE-5778] Add ARRAY_JOIN, ARRAYS_OVERLAP, ARRAYS_ZIP function (e…

tanclary commented on code in PR #3263:
URL: https://github.com/apache/calcite/pull/3263#discussion_r1232569239


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -3883,6 +3883,59 @@ private static AtomicLong getAtomicLong(String key) {
     return atomic;
   }
 
+  /** Support the ARRAYS_OVERLAP function. */
+  public static @Nullable Boolean arraysOverlap(List list1, List list2) {
+    final List bigger = list1.size() > list2.size() ? list1 : list2;
+    final List smaller = list1.size() > list2.size() ? list2 : list1;
+    boolean hasNull = false;

Review Comment:
   could this be simplified using `.retainsAll()` or some other set operation like an `intersect`? I guess the `NULL` behavior could make that more difficult, just wondering.



##########
core/src/main/java/org/apache/calcite/util/BuiltInMethod.java:
##########
@@ -639,6 +639,8 @@ public enum BuiltInMethod {
   ARRAY_INTERSECT(SqlFunctions.class, "arrayIntersect", List.class, List.class),
   ARRAY_UNION(SqlFunctions.class, "arrayUnion", List.class, List.class),
   ARRAY_REVERSE(SqlFunctions.class, "reverse", List.class),
+  ARRAYS_OVERLAP(SqlFunctions.class, "arraysOverlap", List.class, List.class),

Review Comment:
   Why no entry for `ARRAY_JOIN`?



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org