ClickHouse/src/Storages/MergeTree/MergeTreeReaderWide.h

60 lines
2.0 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(
DataPartWidePtr data_part_,
NamesAndTypesList columns_,
const StorageMetadataPtr & metadata_snapshot_,
2019-10-10 16:30:30 +00:00
UncompressedCache * uncompressed_cache_,
MarkCache * mark_cache_,
MarkRanges mark_ranges_,
MergeTreeReaderSettings settings_,
ValueSizeMap avg_value_size_hints_ = {},
const ReadBufferFromFileBase::ProfileCallback & profile_callback_ = {},
2019-10-10 16:30:30 +00:00
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
using FileStreams = std::map<std::string, std::unique_ptr<MergeTreeReaderStream>>;
2021-03-09 14:46:52 +00:00
using Serializations = std::map<std::string, SerializationPtr>;
2019-10-10 16:30:30 +00:00
2021-07-26 00:34:36 +00:00
private:
2019-10-10 16:30:30 +00:00
FileStreams streams;
2021-03-09 14:46:52 +00:00
Serializations serializations;
2021-08-24 22:24:47 +00:00
DiskPtr disk;
2019-10-10 16:30:30 +00:00
void addStreams(const NameAndTypePair & name_and_type,
2019-10-10 16:30:30 +00:00
const ReadBufferFromFileBase::ProfileCallback & profile_callback, clockid_t clock_type);
void readData(
2020-11-10 17:32:00 +00:00
const NameAndTypePair & name_and_type, ColumnPtr & column,
2019-10-10 16:30:30 +00:00
size_t from_mark, bool continue_reading, size_t max_rows_to_read,
2021-03-09 14:46:52 +00:00
ISerialization::SubstreamsCache & cache);
2021-07-26 00:34:36 +00:00
/// Make next readData more simple by calling 'prefetch' of all related ReadBuffers.
void prefetch(
const NameAndTypePair & name_and_type,
size_t from_mark,
bool continue_reading,
ISerialization::SubstreamsCache & cache);
2019-10-10 16:30:30 +00:00
};
}