Merge pull request #64411 from ClickHouse/backport/24.5/64388

Backport #64388 to 24.5: Fix Logical error: Bad cast for Buffer table with prewhere.
This commit is contained in:
Nikolai Kochetov 2024-05-27 18:41:59 +02:00 committed by GitHub
commit 714ed61163
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -302,6 +302,8 @@ void StorageBuffer::read(
auto src_table_query_info = query_info;
if (src_table_query_info.prewhere_info)
{
src_table_query_info.prewhere_info = src_table_query_info.prewhere_info->clone();
auto actions_dag = ActionsDAG::makeConvertingActions(
header_after_adding_defaults.getColumnsWithTypeAndName(),
header.getColumnsWithTypeAndName(),

View File

@ -2,8 +2,14 @@ DROP TABLE IF EXISTS buffer_table1__fuzz_28;
DROP TABLE IF EXISTS merge_tree_table1;
CREATE TABLE merge_tree_table1 (`x` UInt32) ENGINE = MergeTree ORDER BY x;
CREATE TABLE buffer_table1__fuzz_24 (`s` Nullable(Int128), `x` Nullable(FixedString(17))) ENGINE = Buffer(currentDatabase(), 'merge_tree_table1', 16, 10, 60, 10, 1000, 1048576, 2097152);
SELECT s FROM buffer_table1__fuzz_24 PREWHERE factorial(toNullable(10)); -- { serverError ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER }
INSERT INTO merge_tree_table1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
SELECT s FROM buffer_table1__fuzz_24 PREWHERE factorial(toNullable(10)); -- { serverError ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER }
SET send_logs_level='error';
CREATE TABLE buffer_table1__fuzz_28 (`x` Nullable(UInt32)) ENGINE = Buffer(currentDatabase(), 'merge_tree_table1', 16, 10, 60, 10, 1000, 1048576, 2097152);