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

Function readConstantVector

bolt/serializers/PrestoSerializer.cpp:469–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467 bool useLosslessTimestamp);
468
469void readConstantVector(
470 ByteInputStream* source,
471 const TypePtr& type,
472 bolt::memory::MemoryPool* pool,
473 VectorPtr& result,
474 vector_size_t resultOffset,
475 bool useLosslessTimestamp) {
476 const auto size = source->read<int32_t>();
477 std::vector<TypePtr> childTypes = {type};
478 std::vector<VectorPtr> children{BaseVector::create(type, 0, pool)};
479 readColumns(source, pool, childTypes, children, 0, useLosslessTimestamp);
480 BOLT_CHECK_EQ(1, children[0]->size());
481
482 // If there are no previous results, we output this as a constant. RowVectors
483 // with top-level nulls can have child ConstantVector (even though they can't
484 // have nulls explicitly set on them), so we don't need to try to apply
485 // incomingNulls here.
486 auto constantVector = BaseVector::wrapInConstant(size, 0, children[0]);
487
488 if (resultOffset == 0) {
489 result = std::move(constantVector);
490 } else {
491 result->resize(resultOffset + size);
492
493 SelectivityVector rows(resultOffset + size, false);
494 rows.setValidRange(resultOffset, resultOffset + size, true);
495 rows.updateBounds();
496
497 BaseVector::ensureWritable(rows, type, pool, result);
498 result->copy(constantVector.get(), resultOffset, 0, size);
499 }
500}
501
502void readDictionaryVector(
503 ByteInputStream* source,

Callers 1

readColumnsFunction · 0.70

Calls 9

ensureWritableFunction · 0.85
setValidRangeMethod · 0.80
updateBoundsMethod · 0.80
readColumnsFunction · 0.70
createFunction · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected