This is an automated email from the ASF dual-hosted git repository.

zhenchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 799433a1df [CALCITE-5093] Quantified comparison operators (e.g. ANY) 
should support ARRAY arguments
799433a1df is described below

commit 799433a1dfad5d1d8facef89cb4020dbf065f4d2
Author: Zhen Chen <[email protected]>
AuthorDate: Tue Jan 6 08:47:13 2026 +0800

    [CALCITE-5093] Quantified comparison operators (e.g. ANY) should support 
ARRAY arguments
---
 .../org/apache/calcite/test/SqlToRelConverterTest.java |  8 ++++++++
 .../org/apache/calcite/test/SqlToRelConverterTest.xml  | 10 ++++++++++
 core/src/test/resources/sql/some.iq                    | 18 ++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git 
a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java 
b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
index b62b9c247f..3e7d178ee6 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -5705,6 +5705,14 @@ void checkUserDefinedOrderByOver(NullCollation 
nullCollation) {
     expr(expr).ok();
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5093";>[CALCITE-5093]
+   * Quantified comparison operators (e.g. ANY) should support ARRAY 
arguments</a>. */
+  @Test void testArrayType() {
+    String expr = "1 = any(array[1, 2, 3])";
+    expr(expr).withExpand(false).ok();
+  }
+
   @Test void testFunctionExprInOver() {
     String sql = "select ename, row_number() over(partition by 
char_length(ename)\n"
         + " order by deptno desc) as rn\n"
diff --git 
a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml 
b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 0c8ce21928..23be5c89da 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -616,6 +616,16 @@ LogicalSort(sort0=[$0], dir0=[ASC])
     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
 })])
   LogicalValues(tuples=[[{ 0 }]])
+]]>
+    </Resource>
+  </TestCase>
+  <TestCase name="testArrayType">
+    <Resource name="sql">
+      <![CDATA[1 = any(array[1, 2, 3])]]>
+    </Resource>
+    <Resource name="plan">
+      <![CDATA[
+= SOME(1, ARRAY(1, 2, 3))
 ]]>
     </Resource>
   </TestCase>
diff --git a/core/src/test/resources/sql/some.iq 
b/core/src/test/resources/sql/some.iq
index 8b76390081..5c7f6b469f 100644
--- a/core/src/test/resources/sql/some.iq
+++ b/core/src/test/resources/sql/some.iq
@@ -968,5 +968,23 @@ where sal > any (4000, 2000);
 (6 rows)
 
 !ok
+
+# [CALCITE-5093] Quantified comparison operators (e.g. ANY) should support 
ARRAY arguments
+select 1 = any(Array [1, 2, 3]),
+  4 = any(Array [1, 2, 3]),
+  1 > any(Array [1, 2, 3]),
+  1 < any(Array [1, 2, 3]);
++--------+--------+--------+--------+
+| EXPR$0 | EXPR$1 | EXPR$2 | EXPR$3 |
++--------+--------+--------+--------+
+| true   | false  | false  | true   |
++--------+--------+--------+--------+
+(1 row)
+
+!ok
+EnumerableCalc(expr#0=[{inputs}], expr#1=[1], expr#2=[2], expr#3=[3], 
expr#4=[ARRAY($t1, $t2, $t3)], expr#5=[= SOME($t1, $t4)], expr#6=[4], expr#7=[= 
SOME($t6, $t4)], expr#8=[> SOME($t1, $t4)], expr#9=[< SOME($t1, $t4)], 
EXPR$0=[$t5], EXPR$1=[$t7], EXPR$2=[$t8], EXPR$3=[$t9])
+  EnumerableValues(tuples=[[{ 0 }]])
+!plan
+
 # End some.iq
 

Reply via email to