fix prewhere with virtuals columns

This commit is contained in:
Anton Popov 2020-10-08 15:46:28 +03:00
parent 9b9a5d9dc8
commit 1a6d2bc538
3 changed files with 15 additions and 3 deletions

View File

@ -330,9 +330,6 @@ void MergeTreeBaseSelectProcessor::executePrewhereActions(Block & block, const P
auto & ctn = block.getByName(prewhere_info->prewhere_column_name);
ctn.column = ctn.type->createColumnConst(block.rows(), 1u)->convertToFullColumnIfConst();
}
if (!block)
block.insert({nullptr, std::make_shared<DataTypeNothing>(), "_nothing"});
}
}

View File

@ -0,0 +1,3 @@
1_2_2_0 4
2_3_3_0 3
0_1_1_0

View File

@ -0,0 +1,12 @@
DROP TABLE IF EXISTS test_not_found_column_nothing;
CREATE TABLE test_not_found_column_nothing
(
col001 UInt8,
col002 UInt8
) Engine=MergeTree ORDER BY tuple() PARTITION BY col001 % 3;
INSERT INTO test_not_found_column_nothing(col001) SELECT number FROM numbers(11);
SELECT _part, count() FROM test_not_found_column_nothing PREWHERE col001 % 3 != 0 GROUP BY _part ORDER BY _part;
SELECT _part FROM test_not_found_column_nothing PREWHERE col001 = 0;