mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
fix reading of unneded column in case of multistage prewhere
This commit is contained in:
parent
d48b1cadb0
commit
dfc06d2714
@ -340,8 +340,10 @@ MergeTreeReadTaskColumns getReadTaskColumns(
|
|||||||
if (!columns_from_previous_steps.contains(name))
|
if (!columns_from_previous_steps.contains(name))
|
||||||
step_column_names.push_back(name);
|
step_column_names.push_back(name);
|
||||||
|
|
||||||
injectRequiredColumns(
|
if (!step_column_names.empty())
|
||||||
data_part_info_for_reader, storage_snapshot, with_subcolumns, step_column_names);
|
injectRequiredColumns(
|
||||||
|
data_part_info_for_reader, storage_snapshot,
|
||||||
|
with_subcolumns, step_column_names);
|
||||||
|
|
||||||
/// More columns could have been added, filter them as well by the list of columns from previous steps.
|
/// More columns could have been added, filter them as well by the list of columns from previous steps.
|
||||||
Names columns_to_read_in_step;
|
Names columns_to_read_in_step;
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
10496500
|
||||||
|
4
|
@ -0,0 +1,25 @@
|
|||||||
|
-- Tags: no-parallel, no-random-settings, no-random-merge-tree-settings
|
||||||
|
|
||||||
|
drop table if exists t_multi_prewhere;
|
||||||
|
drop row policy if exists policy_02834 on t_multi_prewhere;
|
||||||
|
|
||||||
|
create table t_multi_prewhere (a UInt64, b UInt64, c UInt8)
|
||||||
|
engine = MergeTree order by tuple()
|
||||||
|
settings min_bytes_for_wide_part = 0;
|
||||||
|
|
||||||
|
create row policy policy_02834 on t_multi_prewhere using a > 2000 as permissive to all;
|
||||||
|
insert into t_multi_prewhere select number, number, number from numbers(10000);
|
||||||
|
|
||||||
|
system drop mark cache;
|
||||||
|
select sum(b) from t_multi_prewhere prewhere a < 5000;
|
||||||
|
|
||||||
|
system flush logs;
|
||||||
|
|
||||||
|
select ProfileEvents['FileOpen'] from system.query_log
|
||||||
|
where
|
||||||
|
type = 'QueryFinish'
|
||||||
|
and current_database = currentDatabase()
|
||||||
|
and query ilike '%select sum(b) from t_multi_prewhere prewhere a < 5000%';
|
||||||
|
|
||||||
|
drop table if exists t_multi_prewhere;
|
||||||
|
drop row policy if exists policy_02834 on t_multi_prewhere;
|
Loading…
Reference in New Issue
Block a user