mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Nullable partition pruning fix
This commit is contained in:
parent
e8a5327625
commit
19bd3d8d9f
@ -15,9 +15,21 @@ bool PartitionPruner::canBePruned(const DataPart & part)
|
|||||||
{
|
{
|
||||||
const auto & partition_value = part.partition.value;
|
const auto & partition_value = part.partition.value;
|
||||||
std::vector<FieldRef> index_value(partition_value.begin(), partition_value.end());
|
std::vector<FieldRef> index_value(partition_value.begin(), partition_value.end());
|
||||||
|
for (auto & field : index_value)
|
||||||
|
{
|
||||||
|
// NULL_LAST
|
||||||
|
if (field.isNull())
|
||||||
|
field = POSITIVE_INFINITY;
|
||||||
|
}
|
||||||
is_valid = partition_condition.mayBeTrueInRange(
|
is_valid = partition_condition.mayBeTrueInRange(
|
||||||
partition_value.size(), index_value.data(), index_value.data(), partition_key.data_types);
|
partition_value.size(), index_value.data(), index_value.data(), partition_key.data_types);
|
||||||
partition_filter_map.emplace(partition_id, is_valid);
|
partition_filter_map.emplace(partition_id, is_valid);
|
||||||
|
if (!is_valid)
|
||||||
|
{
|
||||||
|
WriteBufferFromOwnString buf;
|
||||||
|
part.partition.serializeText(part.storage, buf, FormatSettings{});
|
||||||
|
LOG_TRACE(&Poco::Logger::get("PartitionPruner"), "Partition {} gets pruned", buf.str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !is_valid;
|
return !is_valid;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
\N
|
@ -0,0 +1,9 @@
|
|||||||
|
drop table if exists n;
|
||||||
|
|
||||||
|
create table n(nc Nullable(int)) engine = MergeTree order by (tuple()) partition by (nc) settings allow_nullable_key = 1;
|
||||||
|
|
||||||
|
insert into n values (null);
|
||||||
|
|
||||||
|
select * from n where nc is null;
|
||||||
|
|
||||||
|
drop table n;
|
Loading…
Reference in New Issue
Block a user