mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
fix prewhere in case when filter is shrinked by optimization and exists missing default in part
This commit is contained in:
parent
bbd9eb3d3e
commit
32f82629d8
@ -631,7 +631,7 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
|
||||
if (read_result.need_filter)
|
||||
{
|
||||
auto old_columns = block_before_prewhere.getColumns();
|
||||
filterColumns(old_columns, read_result.getFilter()->getData());
|
||||
filterColumns(old_columns, read_result.getFilterOriginal()->getData());
|
||||
block_before_prewhere.setColumns(std::move(old_columns));
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ void MergeTreeRangeReader::executePrewhereActionsAndFilterColumns(ReadResult & r
|
||||
if (result.getFilter())
|
||||
{
|
||||
/// filter might be shrinked while columns not
|
||||
auto result_filter = result.getFilterOriginal() ? result.getFilterOriginal() : result.getFilter();
|
||||
auto result_filter = result.getFilterOriginal();
|
||||
filterColumns(result.columns, result_filter->getData());
|
||||
result.need_filter = true;
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
/// The number of bytes read from disk.
|
||||
size_t numBytesRead() const { return num_bytes_read; }
|
||||
/// Filter you need to apply to newly-read columns in order to add them to block.
|
||||
const ColumnUInt8 * getFilterOriginal() const { return filter_original; }
|
||||
const ColumnUInt8 * getFilterOriginal() const { return filter_original ? filter_original : filter; }
|
||||
const ColumnUInt8 * getFilter() const { return filter; }
|
||||
ColumnPtr & getFilterHolder() { return filter_holder; }
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1,10 @@
|
||||
drop table if exists t;
|
||||
|
||||
create table t (id UInt32, a Int) engine = MergeTree order by id;
|
||||
|
||||
insert into t values (1, 0) (2, 1) (3, 0) (4, 0) (5, 0);
|
||||
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;
|
Loading…
Reference in New Issue
Block a user