aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Analyzer/Passes/MultiIfToIfPass.h
blob: 2213f3713edec35588adbed966f55965c8b44008 (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
#pragma once

#include <Analyzer/IQueryTreePass.h>

namespace DB
{

/** Convert `multiIf` with single condition into `if`.
  *
  * Example: SELECT multiIf(x, 1, 0);
  * Result: SELECT if(x, 1, 0);
  */
class MultiIfToIfPass final : public IQueryTreePass
{
public:
    String getName() override { return "MultiIfToIf"; }

    String getDescription() override { return "Optimize multiIf with single condition to if."; }

    void run(QueryTreeNodePtr query_tree_node, ContextPtr context) override;

};

}