aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Analyzer/IQueryTreePass.h
blob: 4293934c32d472c42b5a2b9b742db095e9f3949a (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
29
30
31
32
33
34
35
36
37
38
#pragma once

#include <Interpreters/Context_fwd.h>

#include <Analyzer/IQueryTreeNode.h>


namespace DB
{

/** After query tree is build it can be later processed by query tree passes.
  * This is abstract base class for all query tree passes.
  *
  * Query tree pass can make query tree modifications, after each pass query tree must be valid.
  * Query tree pass must be isolated and perform only necessary query tree modifications for doing its job.
  * Dependencies between passes must be avoided.
  */
class IQueryTreePass;
using QueryTreePassPtr = std::unique_ptr<IQueryTreePass>;
using QueryTreePasses = std::vector<QueryTreePassPtr>;

class IQueryTreePass
{
public:
    virtual ~IQueryTreePass() = default;

    /// Get query tree pass name
    virtual String getName() = 0;

    /// Get query tree pass description
    virtual String getDescription() = 0;

    /// Run pass over query tree
    virtual void run(QueryTreeNodePtr query_tree_node, ContextPtr context) = 0;

};

}