ClickHouse/dbms/src/Storages/MergeTree/MergeTreeReaderWide.h

49 lines
1.7 KiB
C++
Raw Normal View History

2019-10-10 16:30:30 +00:00
#pragma once
#include <Core/NamesAndTypes.h>
#include <Storages/MergeTree/IMergeTreeReader.h>
namespace DB
{
class MergeTreeDataPartWide;
using DataPartWidePtr = std::shared_ptr<const MergeTreeDataPartWide>;
2020-01-16 16:15:01 +00:00
/// Reader for Wide parts.
2019-10-10 16:30:30 +00:00
class MergeTreeReaderWide : public IMergeTreeReader
{
public:
MergeTreeReaderWide(
const DataPartWidePtr & data_part_,
2019-10-10 16:30:30 +00:00
const NamesAndTypesList & columns_,
UncompressedCache * uncompressed_cache_,
MarkCache * mark_cache_,
const MarkRanges & mark_ranges_,
const MergeTreeReaderSettings & settings_,
2019-10-10 16:30:30 +00:00
const ValueSizeMap & avg_value_size_hints_ = ValueSizeMap{},
const ReadBufferFromFileBase::ProfileCallback & profile_callback_ = ReadBufferFromFileBase::ProfileCallback{},
clockid_t clock_type_ = CLOCK_MONOTONIC_COARSE);
/// Return 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
2019-12-19 13:10:57 +00:00
size_t readRows(size_t from_mark, bool continue_reading, size_t max_rows_to_read, Columns & res_columns) override;
2019-10-10 16:30:30 +00:00
bool canReadIncompleteGranules() const override { return true; }
2019-10-10 16:30:30 +00:00
private:
using FileStreams = std::map<std::string, std::unique_ptr<MergeTreeReaderStream>>;
FileStreams streams;
void addStreams(const String & name, const IDataType & type,
const ReadBufferFromFileBase::ProfileCallback & profile_callback, clockid_t clock_type);
void readData(
const String & name, const IDataType & type, IColumn & column,
size_t from_mark, bool continue_reading, size_t max_rows_to_read,
bool read_offsets = true);
};
}