This is an automated email from the ASF dual-hosted git repository.
xiong 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 9b91d319e7 [CALCITE-6945] Use LITERAL_AGG to simplify
SubQueryRemoveRule by avoiding the extra Project
9b91d319e7 is described below
commit 9b91d319e720ce03cf4d8befae0d5a192a93be99
Author: Xiong Duan <[email protected]>
AuthorDate: Thu Apr 10 09:25:17 2025 +0800
[CALCITE-6945] Use LITERAL_AGG to simplify SubQueryRemoveRule by avoiding
the extra Project
---
.../calcite/rel/rules/SubQueryRemoveRule.java | 21 ++++------
.../java/org/apache/calcite/tools/RelBuilder.java | 8 ++++
.../org/apache/calcite/test/RelOptRulesTest.xml | 30 +++++++-------
core/src/test/resources/sql/sub-query.iq | 48 +++++++++++-----------
4 files changed, 54 insertions(+), 53 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java
b/core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java
index 9bf4e6526c..54a7543608 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java
@@ -323,7 +323,6 @@ private static RexNode rewriteSome(RexSubQuery e,
Set<CorrelationId> variablesSe
}
} else {
final String indicator = "trueLiteral";
- final List<RexNode> parentQueryFields = new ArrayList<>();
switch (op.comparisonKind) {
case GREATER_THAN_OR_EQUAL:
case LESS_THAN_OR_EQUAL:
@@ -348,17 +347,15 @@ private static RexNode rewriteSome(RexSubQuery e,
Set<CorrelationId> variablesSe
// from emp as e
// left outer join (
// select name, max(deptno) as m, count(*) as c, count(deptno) as d,
- // "alwaysTrue" as indicator
+ // LITERAL_AGG(true) as indicator
// from emp group by name) as q on e.name = q.name
builder.push(e.rel)
.aggregate(builder.groupKey(),
builder.aggregateCall(minMax, builder.field(0)).as("m"),
builder.count(false, "c"),
- builder.count(false, "d", builder.field(0)));
-
- parentQueryFields.addAll(builder.fields());
- parentQueryFields.add(builder.alias(literalTrue, indicator));
- builder.project(parentQueryFields).as(qAlias);
+ builder.count(false, "d", builder.field(0)),
+ builder.literalAgg(true, indicator));
+ builder.as(qAlias);
builder.join(JoinRelType.LEFT, literalTrue, variablesSet);
caseRexNode =
builder.call(SqlStdOperatorTable.CASE,
@@ -401,7 +398,7 @@ private static RexNode rewriteSome(RexSubQuery e,
Set<CorrelationId> variablesSe
// from emp as e
// left outer join (
// select name, count(*) as c, count(deptno) as d, count(distinct
deptno) as dd,
- // max(deptno) as m, "alwaysTrue" as indicator
+ // max(deptno) as m, LITERAL_AGG(true) as indicator
// from emp group by name) as q on e.name = q.name
// Additional details on the `q.c <> q.d && q.dd <= 1` clause:
@@ -416,11 +413,9 @@ private static RexNode rewriteSome(RexSubQuery e,
Set<CorrelationId> variablesSe
builder.count(false, "c"),
builder.count(false, "d", builder.field(0)),
builder.count(true, "dd", builder.field(0)),
- builder.max(builder.field(0)).as("m"));
-
- parentQueryFields.addAll(builder.fields());
- parentQueryFields.add(builder.alias(literalTrue, indicator));
- builder.project(parentQueryFields).as(qAlias); // TODO use projectPlus
+ builder.max(builder.field(0)).as("m"),
+ builder.literalAgg(true, indicator));
+ builder.as(qAlias);
builder.join(JoinRelType.LEFT, literalTrue, variablesSet);
caseRexNode =
builder.call(SqlStdOperatorTable.CASE,
diff --git a/core/src/main/java/org/apache/calcite/tools/RelBuilder.java
b/core/src/main/java/org/apache/calcite/tools/RelBuilder.java
index feadf09bb4..158326b6bb 100644
--- a/core/src/main/java/org/apache/calcite/tools/RelBuilder.java
+++ b/core/src/main/java/org/apache/calcite/tools/RelBuilder.java
@@ -1661,6 +1661,14 @@ public AggCall literalAgg(@Nullable Object value) {
.preOperands(literal(value));
}
+ /** Creates a call to the {@code LITERAL_AGG} aggregate function.
+ * optionally an alias. */
+ public AggCall literalAgg(@Nullable Object value, @Nullable String alias,
RexNode... operands) {
+ return aggregateCall(SqlInternalOperators.LITERAL_AGG, false, false, false,
+ null, null, ImmutableList.of(), alias, ImmutableList.of(),
+ ImmutableList.copyOf(operands)).preOperands(literal(value));
+ }
+
// Methods for patterns
/**
diff --git
a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
index 5b2f91af91..d6ebdfd700 100644
--- a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
@@ -15448,8 +15448,8 @@ LogicalProject(DEPTNO=[$0])
LogicalProject(EXPR$0=[CAST(OR(AND(IS TRUE(>($0, $9)), IS NOT TRUE(OR(IS
NULL($12), =($10, 0)))), AND(IS TRUE(>($10, $11)), null, IS NOT TRUE(OR(IS
NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9))), AND(>($0, $9), IS NOT
TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10,
$11))))):BOOLEAN NOT NULL])
LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{2}])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
- LogicalProject(m=[$0], c=[$1], d=[$1], trueLiteral=[true])
- LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])
+ LogicalProject(m=[$0], c=[$1], d=[$1], trueLiteral=[$2])
+ LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()],
trueLiteral=[LITERAL_AGG(true)])
LogicalProject(DEPTNO=[$0])
LogicalFilter(condition=[=($cor0.JOB, $1)])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
@@ -15460,8 +15460,8 @@ LogicalProject(EXPR$0=[CAST(OR(AND(IS TRUE(>($0, $9)),
IS NOT TRUE(OR(IS NULL($1
LogicalProject(EXPR$0=[CAST(OR(AND(IS TRUE(>($0, $9)), IS NOT TRUE(OR(IS
NULL($12), =($10, 0)))), AND(IS TRUE(>($10, $11)), null, IS NOT TRUE(OR(IS
NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9))), AND(>($0, $9), IS NOT
TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10,
$11))))):BOOLEAN NOT NULL])
LogicalJoin(condition=[=($2, $13)], joinType=[left])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
- LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])
- LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])
+ LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[$3], NAME=[$0])
+ LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()],
trueLiteral=[LITERAL_AGG(true)])
LogicalProject(NAME=[$1], DEPTNO=[$0])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
]]>
@@ -16174,16 +16174,14 @@ LogicalProject(EMPNO=[$0])
LogicalCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{1}])
LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])
LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])
- LogicalProject(m=[$0], c=[$1], d=[$2], trueLiteral=[true])
- LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()],
d=[COUNT($0)])
- LogicalProject(DEPTNO=[$0])
- LogicalFilter(condition=[AND(=($cor0.ENAME,
CAST($1):VARCHAR(20)), >($0, 10))])
- LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])
- LogicalProject(m=[$0], c=[$1], d=[$2], trueLiteral=[true])
- LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()], d=[COUNT($0)])
+ LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()],
d=[COUNT($0)], trueLiteral=[LITERAL_AGG(true)])
LogicalProject(DEPTNO=[$0])
- LogicalFilter(condition=[AND(=($cor0.ENAME,
CAST($1):VARCHAR(20)), <($0, 20))])
+ LogicalFilter(condition=[AND(=($cor0.ENAME,
CAST($1):VARCHAR(20)), >($0, 10))])
LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])
+ LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()], d=[COUNT($0)],
trueLiteral=[LITERAL_AGG(true)])
+ LogicalProject(DEPTNO=[$0])
+ LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)),
<($0, 20))])
+ LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])
]]>
</Resource>
</TestCase>
@@ -18581,8 +18579,8 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2],
MGR=[$3], HIREDATE=[$4], SAL=[$
LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), IS NOT TRUE(OR(IS
NULL($12), =($10, 0)))), AND(IS TRUE(>($10, $11)), null, IS NOT TRUE(OR(IS
NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9))), AND(>($0, $9), IS NOT
TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10,
$11))))])
LogicalCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{2}])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
- LogicalProject(m=[$0], c=[$1], d=[$1], trueLiteral=[true])
- LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])
+ LogicalProject(m=[$0], c=[$1], d=[$1], trueLiteral=[$2])
+ LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()],
trueLiteral=[LITERAL_AGG(true)])
LogicalProject(DEPTNO=[$0])
LogicalFilter(condition=[=($cor0.JOB, $1)])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
@@ -18594,8 +18592,8 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2],
MGR=[$3], HIREDATE=[$4], SAL=[$
LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4],
SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], m=[CAST($9):INTEGER],
c=[CAST($10):BIGINT], d=[CAST($11):BIGINT], trueLiteral=[CAST($12):BOOLEAN],
NAME=[CAST($13):VARCHAR(10)])
LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS
NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10,
0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
- LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])
- LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])
+ LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[$3], NAME=[$0])
+ LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()],
trueLiteral=[LITERAL_AGG(true)])
LogicalProject(NAME=[$1], DEPTNO=[$0])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
]]>
diff --git a/core/src/test/resources/sql/sub-query.iq
b/core/src/test/resources/sql/sub-query.iq
index 37523909f2..392463ab3f 100644
--- a/core/src/test/resources/sql/sub-query.iq
+++ b/core/src/test/resources/sql/sub-query.iq
@@ -2651,8 +2651,8 @@ EnumerableCalc(expr#0..6=[{inputs}], expr#7=[>($t1,
$t2)], expr#8=[IS TRUE($t7)]
EnumerableCalc(expr#0..7=[{inputs}], EMPNO=[$t0], DEPTNO=[$t7])
EnumerableTableScan(table=[[scott, EMP]])
EnumerableSort(sort0=[$4], dir0=[ASC])
- EnumerableCalc(expr#0..2=[{inputs}], expr#3=[true], m=[$t1], c=[$t2],
d=[$t2], trueLiteral=[$t3], DEPTNO0=[$t0])
- EnumerableAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])
+ EnumerableCalc(expr#0..3=[{inputs}], m=[$t1], c=[$t2], d=[$t2],
trueLiteral=[$t3], DEPTNO0=[$t0])
+ EnumerableAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()],
trueLiteral=[LITERAL_AGG(true)])
EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t0):SMALLINT NOT
NULL], expr#4=[2], DEPTNO0=[$t3], EXPR$0=[$t4])
EnumerableTableScan(table=[[scott, DEPT]])
!plan
@@ -2763,15 +2763,15 @@ from "scott".emp emp1;
select *
from "scott".emp emp1
where empno <> some (select comm from "scott".emp where deptno = emp1.deptno);
-EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t9, $t8)], expr#15=[1],
expr#16=[<=($t10, $t15)], expr#17=[AND($t14, $t16)], expr#18=[=($t10, $t15)],
expr#19=[OR($t17, $t18)], expr#20=[<>($t0, $t11)], expr#21=[IS NULL($t12)],
expr#22=[0], expr#23=[=($t8, $t22)], expr#24=[OR($t21, $t23)], expr#25=[IS NOT
TRUE($t24)], expr#26=[AND($t19, $t20, $t25)], expr#27=[IS NOT TRUE($t19)],
expr#28=[AND($t25, $t27)], expr#29=[OR($t26, $t28)], proj#0..7=[{exprs}],
$condition=[$t29])
- EnumerableMergeJoin(condition=[=($7, $13)], joinType=[left])
+EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t10, $t9)], expr#15=[1],
expr#16=[<=($t11, $t15)], expr#17=[AND($t14, $t16)], expr#18=[=($t11, $t15)],
expr#19=[OR($t17, $t18)], expr#20=[<>($t0, $t12)], expr#21=[IS NULL($t13)],
expr#22=[0], expr#23=[=($t9, $t22)], expr#24=[OR($t21, $t23)], expr#25=[IS NOT
TRUE($t24)], expr#26=[AND($t19, $t20, $t25)], expr#27=[IS NOT TRUE($t19)],
expr#28=[AND($t25, $t27)], expr#29=[OR($t26, $t28)], proj#0..7=[{exprs}],
$condition=[$t29])
+ EnumerableMergeJoin(condition=[=($7, $8)], joinType=[left])
EnumerableSort(sort0=[$7], dir0=[ASC])
EnumerableTableScan(table=[[scott, EMP]])
- EnumerableSort(sort0=[$5], dir0=[ASC])
- EnumerableCalc(expr#0..4=[{inputs}], expr#5=[CAST($t1):BIGINT NOT NULL],
expr#6=[CAST($t2):BIGINT NOT NULL], expr#7=[true], c=[$t5], d=[$t6], dd=[$t3],
m=[$t4], trueLiteral=[$t7], DEPTNO=[$t0])
- EnumerableAggregate(group=[{1}], c=[MIN($2) FILTER $6], d=[MIN($3)
FILTER $6], dd=[COUNT($0) FILTER $5], m=[MIN($4) FILTER $6])
- EnumerableCalc(expr#0..5=[{inputs}], expr#6=[0], expr#7=[=($t5,
$t6)], expr#8=[2], expr#9=[=($t5, $t8)], proj#0..4=[{exprs}], $g_0=[$t7],
$g_2=[$t9])
- EnumerableAggregate(group=[{6, 7}], groups=[[{6, 7}, {7}]],
c=[COUNT()], d=[COUNT($6)], m=[MAX($6)], $g=[GROUPING($6, $7)])
+ EnumerableSort(sort0=[$0], dir0=[ASC])
+ EnumerableCalc(expr#0..5=[{inputs}], expr#6=[CAST($t1):BIGINT NOT NULL],
expr#7=[CAST($t2):BIGINT NOT NULL], expr#8=[CAST($t5):BOOLEAN NOT NULL],
DEPTNO=[$t0], c=[$t6], d=[$t7], dd=[$t3], m=[$t4], trueLiteral=[$t8])
+ EnumerableAggregate(group=[{1}], c=[MIN($2) FILTER $7], d=[MIN($3)
FILTER $7], dd=[COUNT($0) FILTER $6], m=[MIN($4) FILTER $7],
trueLiteral=[MIN(true, $5) FILTER $7])
+ EnumerableCalc(expr#0..6=[{inputs}], expr#7=[0], expr#8=[=($t6,
$t7)], expr#9=[2], expr#10=[=($t6, $t9)], proj#0..5=[{exprs}], $g_0=[$t8],
$g_2=[$t10])
+ EnumerableAggregate(group=[{6, 7}], groups=[[{6, 7}, {7}]],
c=[COUNT()], d=[COUNT($6)], m=[MAX($6)], trueLiteral=[LITERAL_AGG(true)],
$g=[GROUPING($6, $7)])
EnumerableCalc(expr#0..7=[{inputs}], expr#8=[IS NOT NULL($t7)],
proj#0..7=[{exprs}], $condition=[$t8])
EnumerableTableScan(table=[[scott, EMP]])
!plan
@@ -2822,10 +2822,10 @@ EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t9,
$t8)], expr#15=[1], expr#
EnumerableMergeJoin(condition=[=($0, $13)], joinType=[left])
EnumerableTableScan(table=[[scott, EMP]])
EnumerableSort(sort0=[$5], dir0=[ASC])
- EnumerableCalc(expr#0..3=[{inputs}], expr#4=[CAST($t1):BIGINT NOT NULL],
expr#5=[CAST($t3):INTEGER NOT NULL], expr#6=[true], c=[$t4], d=[$t4], dd=[$t2],
m=[$t5], trueLiteral=[$t6], DEPTNO0=[$t0])
- EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $5], dd=[COUNT($1)
FILTER $4], m=[MIN($3) FILTER $5])
- EnumerableCalc(expr#0..4=[{inputs}], expr#5=[0], expr#6=[=($t4,
$t5)], expr#7=[1], expr#8=[=($t4, $t7)], proj#0..3=[{exprs}], $g_0=[$t6],
$g_1=[$t8])
- EnumerableAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]],
c=[COUNT()], m=[MAX($1)], $g=[GROUPING($0, $1)])
+ EnumerableCalc(expr#0..4=[{inputs}], expr#5=[CAST($t1):BIGINT NOT NULL],
expr#6=[CAST($t3):INTEGER NOT NULL], expr#7=[CAST($t4):BOOLEAN NOT NULL],
c=[$t5], d=[$t5], dd=[$t2], m=[$t6], trueLiteral=[$t7], DEPTNO0=[$t0])
+ EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $6], dd=[COUNT($1)
FILTER $5], m=[MIN($3) FILTER $6], trueLiteral=[MIN(true, $4) FILTER $6])
+ EnumerableCalc(expr#0..5=[{inputs}], expr#6=[0], expr#7=[=($t5,
$t6)], expr#8=[1], expr#9=[=($t5, $t8)], proj#0..4=[{exprs}], $g_0=[$t7],
$g_1=[$t9])
+ EnumerableAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]],
c=[COUNT()], m=[MAX($1)], trueLiteral=[LITERAL_AGG(true)], $g=[GROUPING($0,
$1)])
EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t0):SMALLINT
NOT NULL], expr#4=[2], DEPTNO0=[$t3], EXPR$0=[$t4])
EnumerableTableScan(table=[[scott, DEPT]])
!plan
@@ -2870,10 +2870,10 @@ EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t9,
$t8)], expr#15=[1], expr#
EnumerableMergeJoin(condition=[=($0, $13)], joinType=[left])
EnumerableTableScan(table=[[scott, EMP]])
EnumerableSort(sort0=[$5], dir0=[ASC])
- EnumerableCalc(expr#0..3=[{inputs}], expr#4=[CAST($t1):BIGINT NOT NULL],
expr#5=[CAST($t3):INTEGER NOT NULL], expr#6=[true], c=[$t4], d=[$t4], dd=[$t2],
m=[$t5], trueLiteral=[$t6], DEPTNO0=[$t0])
- EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $5], dd=[COUNT($1)
FILTER $4], m=[MIN($3) FILTER $5])
- EnumerableCalc(expr#0..4=[{inputs}], expr#5=[0], expr#6=[=($t4,
$t5)], expr#7=[1], expr#8=[=($t4, $t7)], proj#0..3=[{exprs}], $g_0=[$t6],
$g_1=[$t8])
- EnumerableAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]],
c=[COUNT()], m=[MAX($1)], $g=[GROUPING($0, $1)])
+ EnumerableCalc(expr#0..4=[{inputs}], expr#5=[CAST($t1):BIGINT NOT NULL],
expr#6=[CAST($t3):INTEGER NOT NULL], expr#7=[CAST($t4):BOOLEAN NOT NULL],
c=[$t5], d=[$t5], dd=[$t2], m=[$t6], trueLiteral=[$t7], DEPTNO0=[$t0])
+ EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $6], dd=[COUNT($1)
FILTER $5], m=[MIN($3) FILTER $6], trueLiteral=[MIN(true, $4) FILTER $6])
+ EnumerableCalc(expr#0..5=[{inputs}], expr#6=[0], expr#7=[=($t5,
$t6)], expr#8=[1], expr#9=[=($t5, $t8)], proj#0..4=[{exprs}], $g_0=[$t7],
$g_1=[$t9])
+ EnumerableAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]],
c=[COUNT()], m=[MAX($1)], trueLiteral=[LITERAL_AGG(true)], $g=[GROUPING($0,
$1)])
EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t0):SMALLINT
NOT NULL], expr#4=[2], DEPTNO0=[$t3], EXPR$0=[$t4])
EnumerableTableScan(table=[[scott, DEPT]])
!plan
@@ -2914,15 +2914,15 @@ from "scott".emp as emp1;
select *
from "scott".emp emp1
where emp1.comm <> some (select comm from "scott".emp emp2 where emp2.sal =
emp1.sal);
-EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t9, $t8)], expr#15=[1],
expr#16=[<=($t10, $t15)], expr#17=[AND($t14, $t16)], expr#18=[=($t10, $t15)],
expr#19=[OR($t17, $t18)], expr#20=[<>($t6, $t11)], expr#21=[IS NULL($t12)],
expr#22=[IS NULL($t6)], expr#23=[0], expr#24=[=($t8, $t23)], expr#25=[OR($t21,
$t22, $t24)], expr#26=[IS NOT TRUE($t25)], expr#27=[AND($t19, $t20, $t26)],
expr#28=[IS NOT TRUE($t19)], expr#29=[AND($t26, $t28)], expr#30=[OR($t27,
$t29)], proj#0..7=[{exprs}], $cond [...]
- EnumerableMergeJoin(condition=[=($5, $13)], joinType=[left])
+EnumerableCalc(expr#0..13=[{inputs}], expr#14=[<>($t10, $t9)], expr#15=[1],
expr#16=[<=($t11, $t15)], expr#17=[AND($t14, $t16)], expr#18=[=($t11, $t15)],
expr#19=[OR($t17, $t18)], expr#20=[<>($t6, $t12)], expr#21=[IS NULL($t13)],
expr#22=[IS NULL($t6)], expr#23=[0], expr#24=[=($t9, $t23)], expr#25=[OR($t21,
$t22, $t24)], expr#26=[IS NOT TRUE($t25)], expr#27=[AND($t19, $t20, $t26)],
expr#28=[IS NOT TRUE($t19)], expr#29=[AND($t26, $t28)], expr#30=[OR($t27,
$t29)], proj#0..7=[{exprs}], $con [...]
+ EnumerableMergeJoin(condition=[=($5, $8)], joinType=[left])
EnumerableSort(sort0=[$5], dir0=[ASC])
EnumerableTableScan(table=[[scott, EMP]])
- EnumerableSort(sort0=[$5], dir0=[ASC])
- EnumerableCalc(expr#0..4=[{inputs}], expr#5=[CAST($t1):BIGINT NOT NULL],
expr#6=[CAST($t2):BIGINT NOT NULL], expr#7=[true], c=[$t5], d=[$t6], dd=[$t3],
m=[$t4], trueLiteral=[$t7], SAL=[$t0])
- EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $6], d=[MIN($3)
FILTER $6], dd=[COUNT($1) FILTER $5], m=[MIN($4) FILTER $6])
- EnumerableCalc(expr#0..5=[{inputs}], expr#6=[0], expr#7=[=($t5,
$t6)], expr#8=[1], expr#9=[=($t5, $t8)], proj#0..4=[{exprs}], $g_0=[$t7],
$g_1=[$t9])
- EnumerableAggregate(group=[{5, 6}], groups=[[{5, 6}, {5}]],
c=[COUNT()], d=[COUNT($6)], m=[MAX($6)], $g=[GROUPING($5, $6)])
+ EnumerableSort(sort0=[$0], dir0=[ASC])
+ EnumerableCalc(expr#0..5=[{inputs}], expr#6=[CAST($t1):BIGINT NOT NULL],
expr#7=[CAST($t2):BIGINT NOT NULL], expr#8=[CAST($t5):BOOLEAN NOT NULL],
SAL=[$t0], c=[$t6], d=[$t7], dd=[$t3], m=[$t4], trueLiteral=[$t8])
+ EnumerableAggregate(group=[{0}], c=[MIN($2) FILTER $7], d=[MIN($3)
FILTER $7], dd=[COUNT($1) FILTER $6], m=[MIN($4) FILTER $7],
trueLiteral=[MIN(true, $5) FILTER $7])
+ EnumerableCalc(expr#0..6=[{inputs}], expr#7=[0], expr#8=[=($t6,
$t7)], expr#9=[1], expr#10=[=($t6, $t9)], proj#0..5=[{exprs}], $g_0=[$t8],
$g_1=[$t10])
+ EnumerableAggregate(group=[{5, 6}], groups=[[{5, 6}, {5}]],
c=[COUNT()], d=[COUNT($6)], m=[MAX($6)], trueLiteral=[LITERAL_AGG(true)],
$g=[GROUPING($5, $6)])
EnumerableCalc(expr#0..7=[{inputs}], expr#8=[IS NOT NULL($t5)],
proj#0..7=[{exprs}], $condition=[$t8])
EnumerableTableScan(table=[[scott, EMP]])
!plan