Fix verbatim partition pruner

This commit is contained in:
Amos Bird 2020-11-09 20:31:51 +08:00
parent 4eb684603a
commit 9961182e86
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 15 additions and 0 deletions

View File

@ -714,6 +714,13 @@ bool KeyCondition::canConstantBeWrappedByFunctions(
break;
}
}
// Check if we have enough columns to fulfill the action.
for (const auto & name : action.getNeededColumns())
{
if (!transform.has(name))
return false;
}
action.execute(transform, true);
}

View File

@ -1,3 +1,4 @@
2 3
9 5
8 4
1 2 3

View File

@ -21,3 +21,10 @@ select * from xy where intHash64(x) % 2 = intHash64(2) % 2;
select * from xy where x = 8;
drop table if exists xy;
-- Test if we provide enough columns to generate a partition value
drop table if exists xyz;
create table xyz(x int, y int, z int) engine MergeTree partition by if(toUInt8(x), y, z) order by x settings index_granularity = 1;
insert into xyz values (1, 2, 3);
select * from xyz where y = 2;
drop table if exists xyz;