| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <Interpreters/InDepthNodeVisitor.h> |
| 4 | |
| 5 | namespace DB |
| 6 | { |
| 7 | |
| 8 | class ASTSelectQuery; |
| 9 | |
| 10 | /// AST transformer. It replaces cross joins with equivalented inner join if possible. |
| 11 | class CrossToInnerJoinMatcher |
| 12 | { |
| 13 | public: |
| 14 | struct Data |
| 15 | { |
| 16 | bool done = false; |
| 17 | }; |
| 18 | |
| 19 | static bool needChildVisit(ASTPtr &, const ASTPtr &) { return true; } |
| 20 | static void visit(ASTPtr & ast, Data & data); |
| 21 | |
| 22 | private: |
| 23 | static void visit(ASTSelectQuery & select, ASTPtr & ast, Data & data); |
| 24 | }; |
| 25 | |
| 26 | using CrossToInnerJoinVisitor = InDepthNodeVisitor<CrossToInnerJoinMatcher, true>; |
| 27 | |
| 28 | } |
| 29 |