[fix](planner) should not bind slot on brother's tuple in subquery#17813
Merged
morrySnow merged 1 commit intoapache:masterfrom Mar 22, 2023
Merged
[fix](planner) should not bind slot on brother's tuple in subquery#17813morrySnow merged 1 commit intoapache:masterfrom
morrySnow merged 1 commit intoapache:masterfrom
Conversation
Contributor
Author
|
run buildall |
starocean999
approved these changes
Mar 15, 2023
starocean999
previously approved these changes
Mar 15, 2023
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Contributor
|
TeamCity pipeline, clickbench performance test result: |
5e941dd to
6bc3800
Compare
Contributor
Author
|
run buildall |
Contributor
Author
|
run buildall |
Contributor
Author
|
run buildall |
Contributor
Author
|
run buildall |
starocean999
approved these changes
Mar 22, 2023
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this pull request
Mar 22, 2023
in PR apache#17813 , we want to forbid bind slot on brother's column howerver the fix is not in correct way. the correct way to do that is forbid subquery register itself in parent's analyzer. This reverts commit b91a3b5.
5 tasks
morningman
pushed a commit
that referenced
this pull request
Mar 28, 2023
…17813) consider the query like this: ```sql SELECT k3, k4 FROM test WHERE EXISTS( SELECT d.* FROM (SELECT k1 AS _1234, SUM(k2) FROM `test` d GROUP BY _1234) d LEFT JOIN (SELECT k1 AS _1234, SUM(k2) FROM `test` GROUP BY _1234) temp ON d._1234 = temp._1234) ORDER BY k3, k4 ``` when we analyze group by exprs in `temp` inline view. we bind the `_1234` on `d._1234` by mistake. that because, when we do analyze in a **SUB-QUERY**, we will resolve SlotRef by itself **AND** parent's tuple. in the meanwhile, we register child's tuple to parent's analyzer. So, in a **SUB-QUERY**, the brother's tuple will affect the resolve result of current inlineview's slot. This PR: 1. add a flag on the function `resolveColumnRef` in `Analyzer` ```java private TupleDescriptor resolveColumnRef(String colName, boolean requestFromChild); private TupleDescriptor resolveColumnRef(TableName tblName, String colName, boolean requestByChild); ``` 2. add a flag to specify whether the tuple is from child. ```java // alias name -> <from child, tupleDesc> private final Multimap<String, Pair<Boolean, TupleDescriptor>> tupleByAlias; ``` when `requestByChild == true`, we **SKIP** the tuple from other child to avoid resolve error.
luwei16
pushed a commit
to luwei16/Doris
that referenced
this pull request
Apr 7, 2023
…from parent tuples (apache#18032)" in PR apache#17813 , we want to forbid bind slot on brother's column howerver the fix is not in correct way. the correct way to do that is forbid subquery register itself in parent's analyzer. This reverts commit b91a3b5.
gnehil
pushed a commit
to gnehil/doris
that referenced
this pull request
Apr 21, 2023
…pache#17813) consider the query like this: ```sql SELECT k3, k4 FROM test WHERE EXISTS( SELECT d.* FROM (SELECT k1 AS _1234, SUM(k2) FROM `test` d GROUP BY _1234) d LEFT JOIN (SELECT k1 AS _1234, SUM(k2) FROM `test` GROUP BY _1234) temp ON d._1234 = temp._1234) ORDER BY k3, k4 ``` when we analyze group by exprs in `temp` inline view. we bind the `_1234` on `d._1234` by mistake. that because, when we do analyze in a **SUB-QUERY**, we will resolve SlotRef by itself **AND** parent's tuple. in the meanwhile, we register child's tuple to parent's analyzer. So, in a **SUB-QUERY**, the brother's tuple will affect the resolve result of current inlineview's slot. This PR: 1. add a flag on the function `resolveColumnRef` in `Analyzer` ```java private TupleDescriptor resolveColumnRef(String colName, boolean requestFromChild); private TupleDescriptor resolveColumnRef(TableName tblName, String colName, boolean requestByChild); ``` 2. add a flag to specify whether the tuple is from child. ```java // alias name -> <from child, tupleDesc> private final Multimap<String, Pair<Boolean, TupleDescriptor>> tupleByAlias; ``` when `requestByChild == true`, we **SKIP** the tuple from other child to avoid resolve error.
gnehil
pushed a commit
to gnehil/doris
that referenced
this pull request
Apr 21, 2023
…arent tuples (apache#18032) in PR apache#17813 , we want to forbid bind slot on brother's column howerver the fix is not in correct way. the correct way to do that is forbid subquery register itself in parent's analyzer. This reverts commit b91a3b5.
mongo360
pushed a commit
to mongo360/doris
that referenced
this pull request
Jul 12, 2023
…pache#17813) consider the query like this: ```sql SELECT k3, k4 FROM test WHERE EXISTS( SELECT d.* FROM (SELECT k1 AS _1234, SUM(k2) FROM `test` d GROUP BY _1234) d LEFT JOIN (SELECT k1 AS _1234, SUM(k2) FROM `test` GROUP BY _1234) temp ON d._1234 = temp._1234) ORDER BY k3, k4 ``` when we analyze group by exprs in `temp` inline view. we bind the `_1234` on `d._1234` by mistake. that because, when we do analyze in a **SUB-QUERY**, we will resolve SlotRef by itself **AND** parent's tuple. in the meanwhile, we register child's tuple to parent's analyzer. So, in a **SUB-QUERY**, the brother's tuple will affect the resolve result of current inlineview's slot. This PR: 1. add a flag on the function `resolveColumnRef` in `Analyzer` ```java private TupleDescriptor resolveColumnRef(String colName, boolean requestFromChild); private TupleDescriptor resolveColumnRef(TableName tblName, String colName, boolean requestByChild); ``` 2. add a flag to specify whether the tuple is from child. ```java // alias name -> <from child, tupleDesc> private final Multimap<String, Pair<Boolean, TupleDescriptor>> tupleByAlias; ``` when `requestByChild == true`, we **SKIP** the tuple from other child to avoid resolve error.
mongo360
pushed a commit
to mongo360/doris
that referenced
this pull request
Jul 12, 2023
…arent tuples (apache#18032) in PR apache#17813 , we want to forbid bind slot on brother's column howerver the fix is not in correct way. the correct way to do that is forbid subquery register itself in parent's analyzer. This reverts commit b91a3b5.
swjtu-zhanglei
pushed a commit
to swjtu-zhanglei/incubator-doris
that referenced
this pull request
Jul 25, 2023
…from parent tuples (apache#18032)" in PR apache#17813 , we want to forbid bind slot on brother's column howerver the fix is not in correct way. the correct way to do that is forbid subquery register itself in parent's analyzer. This reverts commit b91a3b5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Issue Number: close #xxx
Problem summary
consider the query like this:
when we analyze group by exprs in
tempinline view. we bind the_1234ond._1234by mistake.that because, when we do analyze in a SUB-QUERY, we will resolve SlotRef by itself AND parent's tuple. in the meanwhile, we register child's tuple to parent's analyzer. So, in a SUB-QUERY, the brother's tuple will affect the resolve result of current inlineview's slot.
This PR:
resolveColumnRefinAnalyzerwhen
requestByChild == true, we SKIP the tuple from other child to avoid resolve error.Checklist(Required)
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...