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

Method testNullConstant

bolt/vector/tests/VectorTest.cpp:1966–1988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1964
1965 template <TypeKind KIND>
1966 void testNullConstant(const TypePtr& type) {
1967 ASSERT_EQ(KIND, type->kind());
1968 auto baseVector = BaseVector::createNullConstant(type, size_, pool());
1969 auto simpleVector = baseVector->template as<
1970 SimpleVector<typename KindToFlatVector<KIND>::WrapperType>>();
1971 ASSERT_TRUE(simpleVector != nullptr);
1972
1973 ASSERT_EQ(KIND, simpleVector->typeKind());
1974 ASSERT_TRUE(type->equivalent(*simpleVector->type()));
1975 ASSERT_EQ(size_, simpleVector->size());
1976 ASSERT_EQ(simpleVector->isScalar(), TypeTraits<KIND>::isPrimitiveType);
1977
1978 for (auto i = 0; i < simpleVector->size(); i++) {
1979 ASSERT_TRUE(simpleVector->isNullAt(i));
1980 }
1981
1982 auto expectedStr = fmt::format(
1983 "[CONSTANT {}: {} elements, null]", type->toString(), size_);
1984 EXPECT_EQ(expectedStr, baseVector->toString());
1985 for (auto i = 1; i < baseVector->size(); ++i) {
1986 EXPECT_EQ(baseVector->toString(0), baseVector->toString(i));
1987 }
1988 }
1989
1990 protected:
1991 // Theoretical "size" of the constant vector created.

Callers

nothing calls this directly

Calls 9

poolFunction · 0.50
kindMethod · 0.45
typeKindMethod · 0.45
equivalentMethod · 0.45
typeMethod · 0.45
sizeMethod · 0.45
isScalarMethod · 0.45
isNullAtMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected