2015-06-24 11:03:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreeData.h>
|
|
|
|
#include <Storages/MergeTree/MarkRange.h>
|
2015-06-24 11:03:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
struct RangesInDataPart
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
MergeTreeData::DataPartPtr data_part;
|
2017-07-21 06:35:58 +00:00
|
|
|
size_t part_index_in_query;
|
2017-04-01 07:20:54 +00:00
|
|
|
MarkRanges ranges;
|
2015-06-24 11:03:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
RangesInDataPart() = default;
|
2015-06-24 11:03:53 +00:00
|
|
|
|
2019-08-03 11:02:40 +00:00
|
|
|
RangesInDataPart(const MergeTreeData::DataPartPtr & data_part_, const size_t part_index_in_query_,
|
|
|
|
const MarkRanges & ranges_ = MarkRanges{})
|
|
|
|
: data_part{data_part_}, part_index_in_query{part_index_in_query_}, ranges{ranges_}
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
}
|
2019-03-25 13:55:24 +00:00
|
|
|
|
2019-07-18 14:41:11 +00:00
|
|
|
size_t getMarksCount() const
|
|
|
|
{
|
|
|
|
size_t total = 0;
|
|
|
|
for (const auto & range : ranges)
|
|
|
|
total += range.end - range.begin;
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2019-03-25 13:55:24 +00:00
|
|
|
size_t getRowsCount() const
|
|
|
|
{
|
|
|
|
return data_part->index_granularity.getRowsCountInRanges(ranges);
|
|
|
|
}
|
2015-06-24 11:03:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using RangesInDataParts = std::vector<RangesInDataPart>;
|
|
|
|
|
|
|
|
}
|