2019-02-01 16:36:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ASTSelectQuery;
|
|
|
|
|
|
|
|
/// AST transformer. It replaces cross joins with equivalented inner join if possible.
|
|
|
|
class CrossToInnerJoinMatcher
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Data
|
|
|
|
{
|
|
|
|
bool done = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool needChildVisit(ASTPtr &, const ASTPtr &) { return true; }
|
2019-02-22 13:33:56 +00:00
|
|
|
static void visit(ASTPtr & ast, Data & data);
|
2019-02-01 16:36:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void visit(ASTSelectQuery & select, ASTPtr & ast, Data & data);
|
|
|
|
};
|
|
|
|
|
|
|
|
using CrossToInnerJoinVisitor = InDepthNodeVisitor<CrossToInnerJoinMatcher, true>;
|
|
|
|
|
|
|
|
}
|