MCPcopy Create free account
hub / github.com/bytedance/bolt / readDictionaryVector

Function readDictionaryVector

bolt/serializers/PrestoSerializer.cpp:502–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502void readDictionaryVector(
503 ByteInputStream* source,
504 const TypePtr& type,
505 bolt::memory::MemoryPool* pool,
506 VectorPtr& result,
507 vector_size_t resultOffset,
508 bool useLosslessTimestamp) {
509 const auto size = source->read<int32_t>();
510
511 std::vector<TypePtr> childTypes = {type};
512 std::vector<VectorPtr> children{BaseVector::create(type, 0, pool)};
513 readColumns(source, pool, childTypes, children, 0, useLosslessTimestamp);
514
515 // Read indices.
516 BufferPtr indices = allocateIndices(size, pool);
517 source->readBytes(indices->asMutable<char>(), size * sizeof(int32_t));
518
519 // Skip 3 * 8 bytes of 'instance id'. Bolt doesn't use 'instance id' for
520 // dictionary vectors.
521 source->skip(24);
522
523 auto dictionaryVector =
524 BaseVector::wrapInDictionary(nullptr, indices, size, children[0]);
525 if (resultOffset == 0) {
526 result = std::move(dictionaryVector);
527 } else {
528 result->resize(resultOffset + size);
529
530 SelectivityVector rows(resultOffset + size, false);
531 rows.setValidRange(resultOffset, resultOffset + size, true);
532 rows.updateBounds();
533
534 BaseVector::ensureWritable(rows, type, pool, result);
535 result->copy(dictionaryVector.get(), resultOffset, 0, size);
536 }
537}
538
539void readArrayVector(
540 ByteInputStream* source,

Callers 1

readColumnsFunction · 0.70

Calls 12

allocateIndicesFunction · 0.85
wrapInDictionaryFunction · 0.85
ensureWritableFunction · 0.85
setValidRangeMethod · 0.80
updateBoundsMethod · 0.80
readColumnsFunction · 0.70
createFunction · 0.50
readBytesMethod · 0.45
skipMethod · 0.45
resizeMethod · 0.45
copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected