mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix PREWHERE with WHERE in case of always true PREWHERE
This commit is contained in:
parent
b0f05f82b9
commit
16cd70aee9
@ -1044,10 +1044,15 @@ void MergeTreeRangeReader::executePrewhereActionsAndFilterColumns(ReadResult & r
|
|||||||
/// Filter in WHERE instead
|
/// Filter in WHERE instead
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto type = getSampleBlock().getByName(prewhere_info->prewhere_column_name).type;
|
if (prewhere_info->remove_prewhere_column)
|
||||||
ColumnWithTypeAndName col(result.getFilterHolder()->convertToFullColumnIfConst(), std::make_shared<DataTypeUInt8>(), "");
|
result.columns.erase(result.columns.begin() + prewhere_column_pos);
|
||||||
result.columns[prewhere_column_pos] = castColumn(col, type);
|
else
|
||||||
result.clearFilter(); // Acting as a flag to not filter in PREWHERE
|
{
|
||||||
|
auto type = getSampleBlock().getByName(prewhere_info->prewhere_column_name).type;
|
||||||
|
ColumnWithTypeAndName col(result.getFilterHolder()->convertToFullColumnIfConst(), std::make_shared<DataTypeUInt8>(), "");
|
||||||
|
result.columns[prewhere_column_pos] = castColumn(col, type);
|
||||||
|
result.clearFilter(); // Acting as a flag to not filter in PREWHERE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1,5 @@
|
|||||||
|
drop table if exists data_02021;
|
||||||
|
create table data_02021 (key Int) engine=MergeTree() order by key;
|
||||||
|
insert into data_02021 values (1);
|
||||||
|
select count() from data_02021 prewhere 1 or ignore(key) where ignore(key)=0;
|
||||||
|
drop table data_02021;
|
Loading…
Reference in New Issue
Block a user