Cross join to inner rewrite#20392
Conversation
f22319c to
ed9d49a
Compare
8fb8df3 to
1680c8e
Compare
|
For now rules fort |
|
By the way, why do we even have cross/comma join as separate concepts? They are fully equivalent to a clauseless Probably the reason is that we don't have a suitable structure for representing the join tree, and use raw AST for this? |
| throw Exception("Logical error: function requires arguments", ErrorCodes::LOGICAL_ERROR); | ||
| if (node.arguments->children.size() != 2) | ||
| return false; | ||
| std::optional<size_t> getIdentMembership(const ASTIdentifier & ident, const std::vector<TableWithColumnNamesAndTypes> & tables) |
There was a problem hiding this comment.
Nice, this almost starts to look like the proper join clause infrastructure. Eventually we should have an explicit data structure describing the join tree, and then for each WHERE clause, check which relations participate in it, and put it to the appropriate level in this tree.
There was a problem hiding this comment.
I also tried to use this code in #21370 to fix problem with Merge engine. While executing JOIN with Merge there are step when we remove right table from query and perform analysis on it (I don't completly figure out why it is needed, maybe it requires other approach). But expression that uses right table left in query and it leads to error. This code can be used to remove them too.
Yes, I think so. This visitor always rewrites COMMA to CROSS replacing kind ClickHouse/src/Interpreters/CrossToInnerJoinVisitor.cpp Lines 322 to 328 in 90d019a |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CROSS JOINtoINNER JOIN.Close #19856