1#pragma once
2
3#include <Columns/IColumn.h>
4
5
6namespace DB
7{
8
9/// Support methods for implementation of WHERE, PREWHERE and HAVING.
10
11
12/// Analyze if the column for filter is constant thus filter is always false or always true.
13struct ConstantFilterDescription
14{
15 bool always_false = false;
16 bool always_true = false;
17
18 ConstantFilterDescription() {}
19 explicit ConstantFilterDescription(const IColumn & column);
20};
21
22
23/// Obtain a filter from non constant Column, that may have type: UInt8, Nullable(UInt8).
24struct FilterDescription
25{
26 const IColumn::Filter * data = nullptr; /// Pointer to filter when it is not always true or always false.
27 ColumnPtr data_holder; /// If new column was generated, it will be owned by holder.
28
29 explicit FilterDescription(const IColumn & column);
30};
31
32
33struct ColumnWithTypeAndName;
34
35/// Will throw an exception if column_elem is cannot be used as a filter column.
36void checkColumnCanBeUsedAsFilter(const ColumnWithTypeAndName & column_elem);
37
38}
39