You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by dm...@apache.org on 2022/12/12 09:18:26 UTC

[calcite] branch main updated: [CALCITE-5388] tempList expression inside EnumerableWindow.getPartitionIterator should be unoptimized

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

dmsysolyatin 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 81e6f4bf43 [CALCITE-5388] tempList expression inside EnumerableWindow.getPartitionIterator should be unoptimized
81e6f4bf43 is described below

commit 81e6f4bf4315092d679b77d12420b3d764e64cfe
Author: dssysolyatin <dm...@gmail.com>
AuthorDate: Mon Nov 21 14:00:13 2022 +0200

    [CALCITE-5388] tempList expression inside EnumerableWindow.getPartitionIterator should be unoptimized
---
 .../calcite/adapter/enumerable/EnumerableWindow.java |  2 +-
 core/src/test/resources/sql/agg.iq                   | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
index f6dc230d8a..337301aed9 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
@@ -681,7 +681,7 @@ public class EnumerableWindow extends Window implements EnumerableRel {
                   source_,
                   BuiltInMethod.INTO.method,
                   Expressions.new_(ArrayList.class)),
-              List.class));
+              List.class), false);
       return Pair.of(tempList_,
           builder.append(
             "iterator",
diff --git a/core/src/test/resources/sql/agg.iq b/core/src/test/resources/sql/agg.iq
index 8718313948..10d913aa3e 100644
--- a/core/src/test/resources/sql/agg.iq
+++ b/core/src/test/resources/sql/agg.iq
@@ -3467,4 +3467,24 @@ order by ename, deptno;
 
 !ok
 
+# Test case for [CALCITE-5388] tempList expression inside EnumerableWindow.getPartitionIterator should be unoptimized
+with
+    CTE1(rownr1, val1) as ( select ROW_NUMBER() OVER(ORDER BY id ASC), id from (values (1), (2)) as Vals1(id) ),
+    CTE2(rownr2, val2) as ( select ROW_NUMBER() OVER(ORDER BY id ASC), id from (values (1), (2)) as Vals2(id) )
+select
+    CTE1.rownr1, CTE1.val1, CTE2.rownr2, CTE2.val2
+from
+    CTE1,CTE2
+where
+    CTE1.val1 = CTE2.val2;
+
++--------+------+--------+------+
+| ROWNR1 | VAL1 | ROWNR2 | VAL2 |
++--------+------+--------+------+
+|      1 |    1 |      1 |    1 |
+|      2 |    2 |      2 |    2 |
++--------+------+--------+------+
+(2 rows)
+
+!ok
 # End agg.iq