Drop unused columns after join on/using#44545
Conversation
|
Difference in the query plan (running added test on current version): Details |
kitaisreal
left a comment
There was a problem hiding this comment.
Looks good. Need to fix minor details and merge.
| namespace DB | ||
| { | ||
|
|
||
| using ColumnIdentifierSet = std::unordered_set<ColumnIdentifier>; |
There was a problem hiding this comment.
Consider to move this into TableExpressionData.
| if (node->getNodeType() != QueryTreeNodeType::COLUMN) | ||
| return; | ||
|
|
||
| const auto * column_ident = planner_context->getColumnNodeIdentifierOrNull(node); |
There was a problem hiding this comment.
Consider to rename into column_identifier.
| static bool needChildVisit(VisitQueryTreeNodeType &, VisitQueryTreeNodeType & child) | ||
| { | ||
| const auto & node_type = child->getNodeType(); | ||
| return node_type != QueryTreeNodeType::TABLE |
There was a problem hiding this comment.
Consider to remove multiple two spaces after != .
|
|
||
| using ColumnIdentifierSet = std::unordered_set<ColumnIdentifier>; | ||
|
|
||
| /// Collect all top level column identifiers from query tree node. |
There was a problem hiding this comment.
Consider to use /** */ style for multiline comments.
| @@ -0,0 +1,22 @@ | |||
| #pragma once | |||
There was a problem hiding this comment.
Need to rename this file into CollectColumnIdentifiers.h from CollectColumnIndetifiers.h.
|
|
||
| using ColumnIdentifierSet = std::unordered_set<ColumnIdentifier>; | ||
|
|
||
| /// Collect all top level column identifiers from query tree node. |
There was a problem hiding this comment.
Need to add in comment precondition that table expression data must be already collected in planner context.
src/Planner/PlannerJoinTree.h
Outdated
| namespace DB | ||
| { | ||
|
|
||
| using ColumnIdentifierSet = std::unordered_set<ColumnIdentifier>; |
There was a problem hiding this comment.
Need to move this into TableExpressionData and reuse in CollectColumnIdentifiers.
|
|
||
| SET allow_experimental_analyzer = 1; | ||
|
|
||
| EXPLAIN PLAN header = 1 |
There was a problem hiding this comment.
Consider to enable echoOn so test will be easier to verify.
76be3b3 to
1b6e036
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...