1 | #pragma once |
---|---|
2 | |
3 | #include <Storages/MergeTree/MergeTreeData.h> |
4 | #include <Storages/MergeTree/MarkRange.h> |
5 | |
6 | |
7 | namespace DB |
8 | { |
9 | |
10 | |
11 | struct RangesInDataPart |
12 | { |
13 | MergeTreeData::DataPartPtr data_part; |
14 | size_t part_index_in_query; |
15 | MarkRanges ranges; |
16 | |
17 | RangesInDataPart() = default; |
18 | |
19 | RangesInDataPart(const MergeTreeData::DataPartPtr & data_part_, const size_t part_index_in_query_, |
20 | const MarkRanges & ranges_ = MarkRanges{}) |
21 | : data_part{data_part_}, part_index_in_query{part_index_in_query_}, ranges{ranges_} |
22 | { |
23 | } |
24 | |
25 | size_t getMarksCount() const |
26 | { |
27 | size_t total = 0; |
28 | for (const auto & range : ranges) |
29 | total += range.end - range.begin; |
30 | |
31 | return total; |
32 | } |
33 | |
34 | size_t getRowsCount() const |
35 | { |
36 | return data_part->index_granularity.getRowsCountInRanges(ranges); |
37 | } |
38 | }; |
39 | |
40 | using RangesInDataParts = std::vector<RangesInDataPart>; |
41 | |
42 | } |
43 |