MCPcopy Create free account
hub / github.com/ByConity/ByConity / read

Method read

src/DataStreams/NativeBlockInputStream.cpp:233–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void IndexForNativeFormat::read(ReadBuffer & istr, const NameSet & required_columns)
234{
235 while (!istr.eof())
236 {
237 blocks.emplace_back();
238 IndexOfBlockForNativeFormat & block = blocks.back();
239
240 readVarUInt(block.num_columns, istr);
241 readVarUInt(block.num_rows, istr);
242
243 if (block.num_columns < required_columns.size())
244 throw Exception("Index contain less than required columns", ErrorCodes::INCORRECT_INDEX);
245
246 for (size_t i = 0; i < block.num_columns; ++i)
247 {
248 IndexOfOneColumnForNativeFormat column_index;
249
250 readBinary(column_index.name, istr);
251 readBinary(column_index.type, istr);
252 readBinary(column_index.location.offset_in_compressed_file, istr);
253 readBinary(column_index.location.offset_in_decompressed_block, istr);
254
255 if (required_columns.count(column_index.name))
256 block.columns.push_back(std::move(column_index));
257 }
258
259 if (block.columns.size() < required_columns.size())
260 throw Exception("Index contain less than required columns", ErrorCodes::INCORRECT_INDEX);
261 if (block.columns.size() > required_columns.size())
262 throw Exception("Index contain duplicate columns", ErrorCodes::INCORRECT_INDEX);
263
264 block.num_columns = block.columns.size();
265 }
266}
267
268}

Callers 1

readImplMethod · 0.45

Calls 8

readVarUIntFunction · 0.85
ExceptionClass · 0.50
readBinaryFunction · 0.50
eofMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected