fix segfault in MergeTreeRangeReader

This commit is contained in:
CurtizJ 2020-02-14 00:16:40 +03:00
parent 7aeb900922
commit 7041e28077
3 changed files with 13 additions and 1 deletions

View File

@ -333,8 +333,8 @@ void MergeTreeRangeReader::ReadResult::optimize()
filter_holder_original = std::move(filter_holder); filter_holder_original = std::move(filter_holder);
filter = new_filter.get(); filter = new_filter.get();
filter_holder = std::move(new_filter); filter_holder = std::move(new_filter);
need_filter = true;
} }
need_filter = true;
} }
/// Another guess, if it's worth filtering at PREWHERE /// Another guess, if it's worth filtering at PREWHERE
else if (countBytesInResultFilter(filter->getData()) < 0.6 * filter->size()) else if (countBytesInResultFilter(filter->getData()) < 0.6 * filter->size())

View File

@ -0,0 +1,11 @@
drop table if exists t;
create table t (a Int) engine = MergeTree order by a;
-- some magic to satisfy conditions to run optimizations in MergeTreeRangeReader
insert into t select number < 10 ? 0 : 1 from numbers(50);
alter table t add column s String default 'foo';
select s from t prewhere a != 1 where rand() % 2 = 0 limit 1;
drop table t;