aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Analyzer/Passes/ShardNumColumnToFunctionPass.h
blob: 71a038bcf399e1e1b3cbd9d8ec5638da793e4866 (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
{

/** Rewrite _shard_num column into shardNum() function.
  *
  * Example: SELECT _shard_num FROM distributed_table;
  * Result: SELECT shardNum() FROM distributed_table;
  */
class ShardNumColumnToFunctionPass final : public IQueryTreePass
{
public:
    String getName() override { return "ShardNumColumnToFunctionPass"; }

    String getDescription() override { return "Rewrite _shard_num column into shardNum() function"; }

    void run(QueryTreeNodePtr query_tree_node, ContextPtr context) override;

};

}