| 133 | } |
| 134 | |
| 135 | MergeTreeReaderCompact::MergeTreeReaderCompact( |
| 136 | DataPartCompactPtr data_part_, |
| 137 | NamesAndTypesList columns_, |
| 138 | const StorageMetadataPtr & metadata_snapshot_, |
| 139 | UncompressedCache * uncompressed_cache_, |
| 140 | MarkCache * mark_cache_, |
| 141 | MarkRanges mark_ranges_, |
| 142 | MergeTreeReaderSettings settings_, |
| 143 | ValueSizeMap avg_value_size_hints_, |
| 144 | const ReadBufferFromFileBase::ProfileCallback & profile_callback_, |
| 145 | clockid_t clock_type_) |
| 146 | : IMergeTreeReader( |
| 147 | std::move(data_part_), |
| 148 | std::move(columns_), |
| 149 | metadata_snapshot_, |
| 150 | uncompressed_cache_, |
| 151 | mark_cache_, |
| 152 | std::move(mark_ranges_), |
| 153 | std::move(settings_), |
| 154 | std::move(avg_value_size_hints_)) |
| 155 | { |
| 156 | try |
| 157 | { |
| 158 | size_t columns_num = columns.size(); |
| 159 | |
| 160 | column_positions.resize(columns_num); |
| 161 | read_only_offsets.resize(columns_num); |
| 162 | auto name_and_type = columns.begin(); |
| 163 | auto compact_part = std::dynamic_pointer_cast<const MergeTreeDataPartCompact>(data_part); |
| 164 | if (!compact_part) |
| 165 | throw Exception("Can not convert part into MergeTreeDataPartCompact in MergeTreeReaderCompact.", ErrorCodes::LOGICAL_ERROR); |
| 166 | for (size_t i = 0; i < columns_num; ++i, ++name_and_type) |
| 167 | { |
| 168 | if (name_and_type->name == "_part_row_number") |
| 169 | continue; |
| 170 | |
| 171 | if (name_and_type->isSubcolumn()) |
| 172 | { |
| 173 | auto storage_column_from_part = getColumnFromPart( |
| 174 | {name_and_type->getNameInStorage(), name_and_type->getTypeInStorage()}); |
| 175 | |
| 176 | if (!storage_column_from_part.type->tryGetSubcolumnType(name_and_type->getSubcolumnName())) |
| 177 | continue; |
| 178 | } |
| 179 | |
| 180 | NameAndTypePair column_from_part = getColumnFromPart(*name_and_type); |
| 181 | |
| 182 | auto position = compact_part->getColumnPositionWithoutMap(column_from_part.name); |
| 183 | if (!position && typeid_cast<const DataTypeArray *>(column_from_part.type.get())) |
| 184 | { |
| 185 | /// If array of Nested column is missing in part, |
| 186 | /// we have to read its offsets if they exist. |
| 187 | position = findColumnForOffsets(column_from_part.name); |
| 188 | read_only_offsets[i] = (position != std::nullopt); |
| 189 | } |
| 190 | |
| 191 | column_positions[i] = std::move(position); |
| 192 | } |
nothing calls this directly
no test coverage detected