ClickHouse/src/Storages/MergeTree/MergeTreeIndexHypothesis.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.1 KiB
C++
Raw Normal View History

2021-04-26 09:40:54 +00:00
#pragma once
#include <Storages/MergeTree/MergeTreeIndices.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <memory>
namespace DB
{
class MergeTreeIndexHyposesis;
2022-11-17 18:44:26 +00:00
class MergeTreeIndexGranuleHypothesis : public IMergeTreeIndexGranule
2021-04-26 09:40:54 +00:00
{
2022-11-17 18:44:26 +00:00
public:
2021-04-26 09:40:54 +00:00
explicit MergeTreeIndexGranuleHypothesis(
const String & index_name_);
MergeTreeIndexGranuleHypothesis(
const String & index_name_,
bool met_);
2021-04-26 09:40:54 +00:00
void serializeBinary(WriteBuffer & ostr) const override;
void deserializeBinary(ReadBuffer & istr, MergeTreeIndexVersion version) override;
2021-04-26 09:40:54 +00:00
bool empty() const override { return is_empty; }
~MergeTreeIndexGranuleHypothesis() override = default;
2021-05-02 19:16:40 +00:00
const String & index_name;
2021-04-26 09:40:54 +00:00
bool is_empty = true;
bool met = true;
};
2022-11-17 18:44:26 +00:00
class MergeTreeIndexAggregatorHypothesis : public IMergeTreeIndexAggregator
2021-04-26 09:40:54 +00:00
{
2022-11-17 18:44:26 +00:00
public:
2021-04-26 09:40:54 +00:00
explicit MergeTreeIndexAggregatorHypothesis(
const String & index_name_, const String & column_name_);
~MergeTreeIndexAggregatorHypothesis() override = default;
bool empty() const override { return is_empty; }
MergeTreeIndexGranulePtr getGranuleAndReset() override;
void update(const Block & block, size_t * pos, size_t limit) override;
private:
2021-05-02 19:16:40 +00:00
const String & index_name;
2021-04-26 09:40:54 +00:00
String column_name;
bool met = true;
bool is_empty = true;
};
class MergeTreeIndexHypothesis : public IMergeTreeIndex
{
public:
explicit MergeTreeIndexHypothesis(
2021-04-26 09:40:54 +00:00
const IndexDescription & index_)
: IMergeTreeIndex(index_)
{}
~MergeTreeIndexHypothesis() override = default;
2021-05-02 19:16:40 +00:00
bool isMergeable() const override { return true; }
2021-04-26 09:40:54 +00:00
MergeTreeIndexGranulePtr createIndexGranule() const override;
MergeTreeIndexAggregatorPtr createIndexAggregator() const override;
MergeTreeIndexConditionPtr createIndexCondition(
2021-04-27 10:57:59 +00:00
const SelectQueryInfo & query, ContextPtr context) const override;
2021-04-26 09:40:54 +00:00
2022-03-01 21:42:27 +00:00
MergeTreeIndexMergedConditionPtr createIndexMergedCondition(
2021-11-21 19:14:20 +00:00
const SelectQueryInfo & query_info, StorageMetadataPtr storage_metadata) const override;
2021-04-26 09:40:54 +00:00
bool mayBenefitFromIndexForIn(const ASTPtr & node) const override;
size_t max_rows = 0;
};
}