mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Check once if filter column can be always false in filter transform.
This commit is contained in:
parent
9465183408
commit
8524a75580
@ -64,8 +64,7 @@ FilterTransform::FilterTransform(
|
||||
|
||||
IProcessor::Status FilterTransform::prepare()
|
||||
{
|
||||
if (constant_filter_description.always_false
|
||||
|| expression->checkColumnIsAlwaysFalse(filter_column_name))
|
||||
if (constant_filter_description.always_false)
|
||||
{
|
||||
input.close();
|
||||
output.finish();
|
||||
@ -84,6 +83,18 @@ void FilterTransform::removeFilterIfNeed(Chunk & chunk)
|
||||
|
||||
void FilterTransform::transform(Chunk & chunk)
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
|
||||
if (expression->checkColumnIsAlwaysFalse(filter_column_name))
|
||||
{
|
||||
stopReading();
|
||||
chunk = Chunk(getOutputPort().getHeader().getColumns(), 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
size_t num_rows_before_filtration = chunk.getNumRows();
|
||||
auto columns = chunk.detachColumns();
|
||||
|
||||
|
@ -36,6 +36,8 @@ private:
|
||||
/// Header after expression, but before removing filter column.
|
||||
Block transformed_header;
|
||||
|
||||
bool initialized = false;
|
||||
|
||||
void removeFilterIfNeed(Chunk & chunk);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user