-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](Nereids) should not put bound expr into unbound group by list #25938
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
Conversation
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
run buildall |
|
(From new machine)TeamCity pipeline, clickbench performance test result: |
…pache#25938) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ), child output is: [nu#16, sum(k1)apache#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`apache#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
…pache#25938) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ), child output is: [nu#16, sum(k1)apache#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`apache#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
…pache#25938) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ), child output is: [nu#16, sum(k1)apache#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`apache#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
…25938) (#26222) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`#14, sum(k1)#15], excepts=[] ), child output is: [nu#16, sum(k1)#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`#14, sum(k1)#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
…pache#25938) (apache#26222) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ), child output is: [nu#16, sum(k1)apache#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`apache#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
…pache#25938) we put bound expr into unbound group by list by mistake. This will lead to bind twice on some exprssion. Since binding is not idempotent, below exception will be thrown for sql ```sql select k5 / k5 as nu, sum(k1) from test group by nu order by nu nulls first ``` ``` Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Input slot(s) not in child's output: k5#5 in plan: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ), child output is: [nu#16, sum(k1)apache#15] plan tree: LogicalProject[176] ( distinct=false, projects=[(cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#14, sum(k1)apache#15], excepts=[] ) +--LogicalAggregate[168] ( groupByExpr=[nu#16], outputExpr=[nu#16, sum(k1#1) AS `sum(k1)`apache#15], hasRepeat=false ) +--LogicalProject[156] ( distinct=false, projects=[k1#1, (cast(k5#5 as DECIMALV3(16, 10)) / k5#5) AS `nu`apache#16], excepts=[] ) +--LogicalOlapScan ( qualified=default_cluster:regression_test_nereids_syntax_p0.test, indexName=test, selectedIndexId=503229, preAgg=OFF, Aggregate function sum(k1) contains key column k1. ) at org.apache.doris.nereids.rules.analysis.CheckAfterRewrite.checkAllSlotReferenceFromChildren(CheckAfterRewrite.java:108) ~[classes/:?] ```
Proposed changes
Issue Number: close #xxx
we put bound expr into unbound group by list by mistake.
This will lead to bind twice on some exprssion.
Since binding is not idempotent, below exception will be thrown for sql
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...