1 | #include <Storages/MergeTree/MergeTreeIndexReader.h> |
2 | |
3 | |
4 | namespace DB |
5 | { |
6 | |
7 | MergeTreeIndexReader::MergeTreeIndexReader( |
8 | MergeTreeIndexPtr index_, MergeTreeData::DataPartPtr part_, size_t marks_count_, const MarkRanges & all_mark_ranges_) |
9 | : index(index_), stream( |
10 | part_->getFullPath() + index->getFileName(), ".idx" , marks_count_, |
11 | all_mark_ranges_, nullptr, false, nullptr, |
12 | part_->getFileSizeOrZero(index->getFileName() + ".idx" ), 0, DBMS_DEFAULT_BUFFER_SIZE, |
13 | &part_->index_granularity_info, |
14 | ReadBufferFromFileBase::ProfileCallback{}, CLOCK_MONOTONIC_COARSE) |
15 | { |
16 | stream.seekToStart(); |
17 | } |
18 | |
19 | void MergeTreeIndexReader::seek(size_t mark) |
20 | { |
21 | stream.seekToMark(mark); |
22 | } |
23 | |
24 | MergeTreeIndexGranulePtr MergeTreeIndexReader::read() |
25 | { |
26 | auto granule = index->createIndexGranule(); |
27 | granule->deserializeBinary(*stream.data_buffer); |
28 | return granule; |
29 | } |
30 | |
31 | } |
32 | |