-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[CALCITE-3004] RexOver is incorrectly pushed down in ProjectSetOpTran… #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9430,6 +9430,35 @@ LogicalProject(NAME=[$0], ENAME=[$2]) | |
| Uncollect | ||
| LogicalProject(EMPLOYEES=[$cor1.EMPLOYEES]) | ||
| LogicalValues(tuples=[[{ 0 }]]) | ||
| ]]> | ||
| </Resource> | ||
| </TestCase> | ||
| <TestCase name="testProjectSetOpTranspose"> | ||
| <Resource name="sql"> | ||
| <![CDATA[select job, sum(sal + 100) over (partition by deptno) from | ||
| (select * from emp e1 union all select * from emp e2) | ||
| ]]> | ||
| </Resource> | ||
| <Resource name="planBefore"> | ||
| <![CDATA[ | ||
| LogicalProject(JOB=[$2], EXPR$1=[SUM(+($5, 100)) OVER (PARTITION BY $7 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)]) | ||
| LogicalUnion(all=[true]) | ||
| LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, EMP]]) | ||
| LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, EMP]]) | ||
| ]]> | ||
| </Resource> | ||
| <Resource name="planAfter"> | ||
| <![CDATA[ | ||
| LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)]) | ||
| LogicalUnion(all=[true]) | ||
| LogicalProject(JOB=[$2], DEPTNO=[$7], +=[+($5, 100)]) | ||
| LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, EMP]]) | ||
| LogicalProject(JOB=[$2], DEPTNO=[$7], +=[+($5, 100)]) | ||
| LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, EMP]]) | ||
| ]]> | ||
| </Resource> | ||
| </TestCase> | ||
|
|
@@ -9484,6 +9513,36 @@ LogicalProject(NAME=[$0], ENAME=[$2]) | |
| Uncollect | ||
| LogicalProject(EMPLOYEES=[$cor1.EMPLOYEES]) | ||
| LogicalValues(tuples=[[{ 0 }]]) | ||
| ]]> | ||
| </Resource> | ||
| </TestCase> | ||
| <TestCase name="testProjectCorrelateTransposeWithOver"> | ||
| <Resource name="sql"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that [1] https://github.com/apache/calcite/blob/master/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml#L9226
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah. Somehow there's a duplicate key in RelOptRulesTest.xml. Maybe it's a merge error, I don't know. Can someone add code to DiffRepository to make it fail when reading a .xml file if there are duplicate keys.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @julianhyde I would like to do it. : )
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened an issue(CALCITE-3009) for it. |
||
| <![CDATA[select sum(t1.deptno + 1) over (partition by t1.name), | ||
| count(t2.empno) over () | ||
| from DEPT_NESTED as t1, unnest(t1.employees) as t2 | ||
| ]]> | ||
| </Resource> | ||
| <Resource name="planBefore"> | ||
| <![CDATA[ | ||
| LogicalProject(EXPR$0=[SUM(+($0, 1)) OVER (PARTITION BY $1 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)], EXPR$1=[COUNT($4) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)]) | ||
| LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3}]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]]) | ||
| Uncollect | ||
| LogicalProject(EMPLOYEES=[$cor0.EMPLOYEES]) | ||
| LogicalValues(tuples=[[{ 0 }]]) | ||
| ]]> | ||
| </Resource> | ||
| <Resource name="planAfter"> | ||
| <![CDATA[ | ||
| LogicalProject(EXPR$0=[SUM($2) OVER (PARTITION BY $0 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)], EXPR$1=[COUNT($3) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)]) | ||
| LogicalCorrelate(correlation=[$cor1], joinType=[inner], requiredColumns=[{1}]) | ||
| LogicalProject(NAME=[$1], EMPLOYEES=[$3], +=[+($0, 1)]) | ||
| LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]]) | ||
| LogicalProject(EMPNO=[$0]) | ||
| Uncollect | ||
| LogicalProject(EMPLOYEES=[$cor1.EMPLOYEES]) | ||
| LogicalValues(tuples=[[{ 0 }]]) | ||
| ]]> | ||
| </Resource> | ||
| </TestCase> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
if..else..in that I don't want to change the plan of some cases. For instance, current plan ofis
But if without
if..else.., the plan becomeswhich seems redundant.