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

#include <Analyzer/IQueryTreePass.h>

namespace DB
{

/** Transform functions to subcolumns. Enabled using setting optimize_functions_to_subcolumns.
  * It can help to reduce amount of read data.
  *
  * Example: SELECT tupleElement(column, subcolumn) FROM test_table;
  * Result: SELECT column.subcolumn FROM test_table;
  *
  * Example: SELECT length(array_column) FROM test_table;
  * Result: SELECT array_column.size0 FROM test_table;
  *
  * Example: SELECT nullable_column IS NULL FROM test_table;
  * Result: SELECT nullable_column.null FROM test_table;
  */
class FunctionToSubcolumnsPass final : public IQueryTreePass
{
public:
    String getName() override { return "FunctionToSubcolumns"; }

    String getDescription() override { return "Rewrite function to subcolumns, for example tupleElement(column, subcolumn) into column.subcolumn"; }

    void run(QueryTreeNodePtr query_tree_node, ContextPtr context) override;

};

}