2017-12-14 21:51:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Columns/IColumn.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-12-15 00:01:59 +00:00
|
|
|
/// Support methods for implementation of WHERE, PREWHERE and HAVING.
|
|
|
|
|
|
|
|
|
|
|
|
/// Analyze if the column for filter is constant thus filter is always false or always true.
|
|
|
|
struct ConstantFilterDescription
|
2017-12-14 21:51:30 +00:00
|
|
|
{
|
|
|
|
bool always_false = false;
|
|
|
|
bool always_true = false;
|
2017-12-15 00:01:59 +00:00
|
|
|
|
|
|
|
ConstantFilterDescription() {}
|
|
|
|
explicit ConstantFilterDescription(const IColumn & column);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Obtain a filter from non constant Column, that may have type: UInt8, Nullable(UInt8).
|
|
|
|
struct FilterDescription
|
|
|
|
{
|
2017-12-14 21:51:30 +00:00
|
|
|
const IColumn::Filter * data = nullptr; /// Pointer to filter when it is not always true or always false.
|
|
|
|
ColumnPtr data_holder; /// If new column was generated, it will be owned by holder.
|
|
|
|
|
2017-12-15 00:01:59 +00:00
|
|
|
explicit FilterDescription(const IColumn & column);
|
2017-12-14 21:51:30 +00:00
|
|
|
};
|
|
|
|
|
2018-05-15 12:56:14 +00:00
|
|
|
|
|
|
|
struct ColumnWithTypeAndName;
|
|
|
|
|
|
|
|
/// Will throw an exception if column_elem is cannot be used as a filter column.
|
|
|
|
void checkColumnCanBeUsedAsFilter(const ColumnWithTypeAndName & column_elem);
|
|
|
|
|
2017-12-14 21:51:30 +00:00
|
|
|
}
|