2019-02-05 14:50:25 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreeIndexReader.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
MergeTreeIndexReader::MergeTreeIndexReader(
|
2020-06-25 19:31:54 +00:00
|
|
|
MergeTreeIndexPtr index_, MergeTreeData::DataPartPtr part_, size_t marks_count_, const MarkRanges & all_mark_ranges_,
|
|
|
|
MergeTreeReaderSettings settings)
|
2019-08-03 11:02:40 +00:00
|
|
|
: index(index_), stream(
|
2020-05-09 21:24:15 +00:00
|
|
|
part_->volume->getDisk(),
|
2020-02-27 16:47:40 +00:00
|
|
|
part_->getFullRelativePath() + index->getFileName(), ".idx", marks_count_,
|
2019-12-18 16:41:11 +00:00
|
|
|
all_mark_ranges_,
|
2020-06-25 19:31:54 +00:00
|
|
|
std::move(settings), nullptr, nullptr,
|
2019-10-10 16:30:30 +00:00
|
|
|
part_->getFileSizeOrZero(index->getFileName() + ".idx"),
|
2019-08-03 11:02:40 +00:00
|
|
|
&part_->index_granularity_info,
|
2019-02-05 14:50:25 +00:00
|
|
|
ReadBufferFromFileBase::ProfileCallback{}, CLOCK_MONOTONIC_COARSE)
|
|
|
|
{
|
|
|
|
stream.seekToStart();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MergeTreeIndexReader::seek(size_t mark)
|
|
|
|
{
|
|
|
|
stream.seekToMark(mark);
|
|
|
|
}
|
|
|
|
|
|
|
|
MergeTreeIndexGranulePtr MergeTreeIndexReader::read()
|
|
|
|
{
|
|
|
|
auto granule = index->createIndexGranule();
|
|
|
|
granule->deserializeBinary(*stream.data_buffer);
|
|
|
|
return granule;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|