ClickHouse/src/Storages/MergeTree/MergeTreeReverseSelectProcessor.h

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

45 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <Storages/MergeTree/MergeTreeSelectProcessor.h>
#include <Common/logger_useful.h>
2021-07-17 18:06:46 +00:00
namespace DB
{
/// Used to read data from single part with select query
/// in reverse order of primary key.
/// Cares about PREWHERE, virtual columns, indexes etc.
/// To read data from multiple parts, Storage (MergeTree) creates multiple such objects.
2022-11-18 20:09:20 +00:00
class MergeTreeReverseSelectAlgorithm final : public MergeTreeSelectAlgorithm
{
public:
template <typename... Args>
2022-11-18 20:09:20 +00:00
explicit MergeTreeReverseSelectAlgorithm(Args &&... args)
: MergeTreeSelectAlgorithm{std::forward<Args>(args)...}
{
LOG_TRACE(log, "Reading {} ranges in reverse order from part {}, approx. {} rows starting from {}",
all_mark_ranges.size(), data_part->name, total_rows,
data_part->index_granularity.getMarkStartingRow(all_mark_ranges.front().begin));
}
String getName() const override { return "MergeTreeReverse"; }
private:
bool getNewTaskImpl() override;
void finalizeNewTask() override {}
2023-02-03 13:34:18 +00:00
bool getNewTaskParallelReplicas();
bool getNewTaskOrdinaryReading();
2022-11-18 20:09:20 +00:00
BlockAndProgress readFromPart() override;
2022-11-18 20:09:20 +00:00
std::vector<BlockAndProgress> chunks;
2023-02-03 13:34:18 +00:00
/// Used for parallel replicas
bool no_more_tasks{false};
2020-05-30 21:57:37 +00:00
Poco::Logger * log = &Poco::Logger::get("MergeTreeReverseSelectProcessor");
};
}