2021-06-25 16:22:39 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Storages/MergeTree/MergeTreeSelectProcessor.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// Used to read data from single part with select query in 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 MergeTreeInOrderSelectAlgorithm final : public MergeTreeSelectAlgorithm
|
2021-06-25 16:22:39 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-07-16 14:11:34 +00:00
|
|
|
template <typename... Args>
|
2022-11-18 20:09:20 +00:00
|
|
|
explicit MergeTreeInOrderSelectAlgorithm(Args &&... args)
|
|
|
|
: MergeTreeSelectAlgorithm{std::forward<Args>(args)...}
|
2021-07-16 14:11:34 +00:00
|
|
|
{
|
2022-02-04 14:53:20 +00:00
|
|
|
LOG_TRACE(log, "Reading {} ranges in order from part {}, approx. {} rows starting from {}",
|
2021-07-16 14:11:34 +00:00
|
|
|
all_mark_ranges.size(), data_part->name, total_rows,
|
|
|
|
data_part->index_granularity.getMarkStartingRow(all_mark_ranges.front().begin));
|
|
|
|
}
|
2021-06-25 16:22:39 +00:00
|
|
|
|
2021-07-16 14:11:34 +00:00
|
|
|
String getName() const override { return "MergeTreeInOrder"; }
|
2021-06-25 16:22:39 +00:00
|
|
|
|
|
|
|
private:
|
2021-12-09 10:39:28 +00:00
|
|
|
bool getNewTaskImpl() override;
|
|
|
|
void finalizeNewTask() override {}
|
2021-06-25 16:22:39 +00:00
|
|
|
|
|
|
|
Poco::Logger * log = &Poco::Logger::get("MergeTreeInOrderSelectProcessor");
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|