aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/MergeTreeReaderInMemory.h
blob: e26a98f0916de9423d95168533ebe57ecd6acba3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <Core/NamesAndTypes.h>
#include <Storages/MergeTree/IMergeTreeReader.h>


namespace DB
{

class MergeTreeDataPartInMemory;
using DataPartInMemoryPtr = std::shared_ptr<const MergeTreeDataPartInMemory>;

/// Reader for InMemory parts
class MergeTreeReaderInMemory : public IMergeTreeReader
{
public:
    MergeTreeReaderInMemory(
        MergeTreeDataPartInfoForReaderPtr data_part_info_for_read_,
        DataPartInMemoryPtr data_part_,
        NamesAndTypesList columns_,
        const StorageSnapshotPtr & storage_snapshot_,
        MarkRanges mark_ranges_,
        MergeTreeReaderSettings settings_);

    /// 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
    size_t readRows(size_t from_mark, size_t current_tasl_last_mark,
                    bool continue_reading, size_t max_rows_to_read, Columns & res_columns) override;

    bool canReadIncompleteGranules() const override { return true; }

private:
    size_t total_rows_read = 0;
    DataPartInMemoryPtr part_in_memory;

    std::unordered_map<String, size_t> positions_for_offsets;
};

}