| 83 | MergeTreeIndexReader::~MergeTreeIndexReader() = default; |
| 84 | |
| 85 | void MergeTreeIndexReader::initStreamIfNeeded() |
| 86 | { |
| 87 | if (!streams.empty()) |
| 88 | return; |
| 89 | |
| 90 | auto index_format = index->getDeserializedFormat(part->checksums, index->getFileName(), &part->getDataPartStorage()); |
| 91 | auto index_name = index->getFileName(); |
| 92 | auto last_mark = getLastMark(all_mark_ranges); |
| 93 | |
| 94 | for (const auto & substream : index_format.substreams) |
| 95 | { |
| 96 | auto full_stream_name = index_name + substream.suffix; |
| 97 | auto stream_name_opt = DB::IMergeTreeDataPart::getStreamNameOrHash(full_stream_name, substream.extension, part->checksums); |
| 98 | |
| 99 | /// If the stream doesn't exist (neither original nor hashed name), use the full name |
| 100 | /// and let it fail later when trying to open the file. This preserves the original error |
| 101 | /// behavior and compatibility - the error message will indicate the missing file path. |
| 102 | auto stream_name = stream_name_opt.value_or(full_stream_name); |
| 103 | |
| 104 | auto stream = makeIndexReaderStream( |
| 105 | stream_name, |
| 106 | substream.extension, |
| 107 | part, |
| 108 | marks_count, |
| 109 | all_mark_ranges, |
| 110 | mark_cache, |
| 111 | uncompressed_cache, |
| 112 | patchSettings(settings, substream.type)); |
| 113 | |
| 114 | stream->adjustRightMark(last_mark); |
| 115 | stream->seekToStart(); |
| 116 | |
| 117 | streams[substream.type] = stream.get(); |
| 118 | stream_holders.emplace_back(std::move(stream)); |
| 119 | } |
| 120 | |
| 121 | version = index_format.version; |
| 122 | } |
| 123 | |
| 124 | void MergeTreeIndexReader::read(size_t mark, const IMergeTreeIndexCondition * condition, MergeTreeIndexGranulePtr & granule) |
| 125 | { |
nothing calls this directly
no test coverage detected