aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Analyzer/Passes/CrossToInnerJoinPass.h
blob: 127d26dc41df863ff2e1597966234f9cf3afa54f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <Analyzer/IQueryTreePass.h>

namespace DB
{


/** Replace CROSS JOIN with INNER JOIN.
  * Example:
  *   SELECT * FROM t1 CROSS JOIN t2 WHERE t1.a = t2.a AND t1.b > 10 AND t2.b = t2.c
  * We can move equality condition to ON section of INNER JOIN:
  *   SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a WHERE t1.b > 10 AND t2.b = t2.c
  */
class CrossToInnerJoinPass final : public IQueryTreePass
{
public:
    String getName() override { return "CrossToInnerJoin"; }

    String getDescription() override
    {
        return "Replace CROSS JOIN with INNER JOIN";
    }

    void run(QueryTreeNodePtr query_tree_node, ContextPtr context) override;
};

}