1 | #pragma once |
2 | #include <Storages/MergeTree/MergeTreeBaseSelectProcessor.h> |
3 | |
4 | |
5 | namespace DB |
6 | { |
7 | |
8 | class MergeTreeReadPool; |
9 | |
10 | |
11 | /** Used in conjunction with MergeTreeReadPool, asking it for more work to do and performing whatever reads it is asked |
12 | * to perform. |
13 | */ |
14 | class MergeTreeThreadSelectBlockInputProcessor : public MergeTreeBaseSelectProcessor |
15 | { |
16 | public: |
17 | MergeTreeThreadSelectBlockInputProcessor( |
18 | const size_t thread_, |
19 | const std::shared_ptr<MergeTreeReadPool> & pool_, |
20 | const size_t min_marks_to_read_, |
21 | const UInt64 max_block_size_, |
22 | size_t preferred_block_size_bytes_, |
23 | size_t preferred_max_column_in_block_size_bytes_, |
24 | const MergeTreeData & storage_, |
25 | const bool use_uncompressed_cache_, |
26 | const PrewhereInfoPtr & prewhere_info_, |
27 | const Settings & settings_, |
28 | const Names & virt_column_names_); |
29 | |
30 | String getName() const override { return "MergeTreeThread" ; } |
31 | |
32 | ~MergeTreeThreadSelectBlockInputProcessor() override; |
33 | |
34 | protected: |
35 | /// Requests read task from MergeTreeReadPool and signals whether it got one |
36 | bool getNewTask() override; |
37 | |
38 | private: |
39 | /// "thread" index (there are N threads and each thread is assigned index in interval [0..N-1]) |
40 | size_t thread; |
41 | |
42 | std::shared_ptr<MergeTreeReadPool> pool; |
43 | size_t min_marks_to_read; |
44 | |
45 | /// Last part readed in this thread |
46 | std::string last_readed_part_path; |
47 | /// Names from header. Used in order to order columns in read blocks. |
48 | Names ordered_names; |
49 | }; |
50 | |
51 | } |
52 | |