ClickHouse/src/Storages/MergeTree/MergeTreeReaderCompactSingleBuffer.h
2024-03-18 15:57:58 +00:00

34 lines
1.1 KiB
C++

#pragma once
#include <Storages/MergeTree/MergeTreeReaderCompact.h>
#include <Storages/MergeTree/MergeTreeReaderStream.h>
namespace DB
{
/// Reader for compact parts, that uses one buffer for
/// all column and doesn't support parallel prefetch of columns.
/// It's suitable for compact parts with small size of stripe.
class MergeTreeReaderCompactSingleBuffer : public MergeTreeReaderCompact
{
public:
template <typename... Args>
explicit MergeTreeReaderCompactSingleBuffer(Args &&... args)
: MergeTreeReaderCompact{std::forward<Args>(args)...}
{
fillColumnPositions();
}
/// Returns the number of rows has been read or zero if there is no columns to read.
/// If continue_reading is true, continue reading from last state, otherwise seek to from_mark
size_t readRows(size_t from_mark, size_t current_task_last_mark,
bool continue_reading, size_t max_rows_to_read, Columns & res_columns) override;
private:
void init();
bool initialized = false;
std::unique_ptr<MergeTreeReaderStream> stream;
};
}