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

Method testConstantNull

bolt/vector/tests/DecodedVectorTest.cpp:253–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251 }
252
253 void testConstantNull(const TypePtr& type) {
254 SCOPED_TRACE(type->toString());
255 auto constantVector =
256 BaseVector::createNullConstant(type, 100, pool_.get());
257 EXPECT_EQ(constantVector->isScalar(), type->isPrimitiveType());
258
259 auto check = [&](auto& decoded) {
260 EXPECT_EQ(*decoded.base()->type(), *type);
261 // Decoded vector doesn't ensure base() has "FLAT" encoding for primitive
262 // types.
263 if (!type->isPrimitiveType()) {
264 EXPECT_EQ(
265 decoded.base()->encoding(),
266 BaseVector::create(type, 1, pool_.get())->encoding());
267 }
268 EXPECT_TRUE(decoded.isConstantMapping());
269 EXPECT_TRUE(!decoded.isIdentityMapping());
270 ASSERT_TRUE(decoded.nulls(nullptr) != nullptr);
271 for (int32_t i = 0; i < 100; i++) {
272 EXPECT_TRUE(decoded.isNullAt(i));
273 EXPECT_TRUE(bits::isBitNull(decoded.nulls(nullptr), i));
274 }
275 };
276
277 {
278 SelectivityVector selection(100);
279 DecodedVector decoded(*constantVector, selection);
280 check(decoded);
281 }
282
283 {
284 DecodedVector decoded(*constantVector);
285 check(decoded);
286 }
287 }
288
289 void testDictionaryOverConstant(const VectorPtr& base, vector_size_t index) {
290 constexpr vector_size_t size = 1000;

Callers

nothing calls this directly

Calls 13

isBitNullFunction · 0.85
isConstantMappingMethod · 0.80
isIdentityMappingMethod · 0.80
createFunction · 0.50
toStringMethod · 0.45
getMethod · 0.45
isScalarMethod · 0.45
isPrimitiveTypeMethod · 0.45
typeMethod · 0.45
baseMethod · 0.45
encodingMethod · 0.45
nullsMethod · 0.45

Tested by

no test coverage detected