2020-10-22 06:18:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
#include <Storages/KeyDescription.h>
|
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
|
|
|
#include <Storages/MergeTree/KeyCondition.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-11-06 03:50:58 +00:00
|
|
|
/// Pruning partitions in verbatim way using KeyCondition
|
2020-10-22 06:18:10 +00:00
|
|
|
class PartitionPruner
|
|
|
|
{
|
2023-01-22 17:02:38 +00:00
|
|
|
public:
|
|
|
|
PartitionPruner(const StorageMetadataPtr & metadata, const SelectQueryInfo & query_info, ContextPtr context, bool strict);
|
|
|
|
|
|
|
|
bool canBePruned(const IMergeTreeDataPart & part);
|
|
|
|
|
|
|
|
bool isUseless() const { return useless; }
|
|
|
|
|
|
|
|
const KeyCondition & getKeyCondition() const { return partition_condition; }
|
|
|
|
|
2020-10-22 06:18:10 +00:00
|
|
|
private:
|
|
|
|
std::unordered_map<String, bool> partition_filter_map;
|
2021-05-21 16:14:01 +00:00
|
|
|
|
|
|
|
/// partition_key is adjusted here (with substitution from modulo to moduloLegacy).
|
|
|
|
KeyDescription partition_key;
|
|
|
|
|
2020-10-22 06:18:10 +00:00
|
|
|
KeyCondition partition_condition;
|
|
|
|
|
2023-01-22 17:02:38 +00:00
|
|
|
bool useless = false;
|
2020-10-22 06:18:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|