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

Method pop

bolt/vector/VectorPool.cpp:116–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116VectorPtr VectorPool::TypePool::pop(
117 const TypePtr& type,
118 vector_size_t vectorSize,
119 memory::MemoryPool& pool) {
120 if (size) {
121 auto result = std::move(vectors[--size]);
122 if (UNLIKELY(result->rawNulls() != nullptr)) {
123 // This is a recyclable vector, no need to check uniqueness.
124 simd::memset(
125 const_cast<uint64_t*>(result->rawNulls()),
126 bits::kNotNullByte,
127 bits::roundUp(std::min<int32_t>(vectorSize, result->size()), 64) / 8);
128 }
129 if (UNLIKELY(
130 result->typeKind() == TypeKind::VARCHAR ||
131 result->typeKind() == TypeKind::VARBINARY)) {
132 simd::memset(
133 const_cast<void*>(result->valuesAsVoid()),
134 0,
135 std::min<int32_t>(vectorSize, result->size()) * sizeof(StringView));
136 }
137 if (result->size() != vectorSize) {
138 result->resize(vectorSize);
139 }
140 return result;
141 }
142 return BaseVector::create(type, vectorSize, &pool);
143}
144} // namespace bytedance::bolt

Callers 1

getMethod · 0.45

Calls 8

memsetFunction · 0.85
roundUpFunction · 0.85
rawNullsMethod · 0.80
createFunction · 0.70
sizeMethod · 0.45
typeKindMethod · 0.45
valuesAsVoidMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected