Fix empty block with row_filter

This commit is contained in:
Amos Bird 2021-04-29 19:40:14 +08:00
parent 186b1128d0
commit 70ec13f3d3
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 16 additions and 1 deletions

View File

@ -941,7 +941,10 @@ void MergeTreeRangeReader::executePrewhereActionsAndFilterColumns(ReadResult & r
auto columns = block.getColumns();
filterColumns(columns, row_level_filter);
block.setColumns(columns);
if (columns.empty())
block = block.cloneEmpty();
else
block.setColumns(columns);
}
prewhere_info->prewhere_actions->execute(block);

View File

@ -0,0 +1,12 @@
drop table if exists tbl;
create table tbl (s String, i int) engine MergeTree order by i;
insert into tbl values ('123', 123);
drop row policy if exists filter on tbl;
create row policy filter on tbl using (s = 'non_existing_domain') to all;
select * from tbl prewhere s = '123' where i = 123;
drop row policy filter on tbl;
drop table tbl;