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

Method testConstant

bolt/vector/tests/DecodedVectorTest.cpp:156–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154
155 template <typename T>
156 void testConstant(const T& value) {
157 variant var = variant(value);
158
159 auto constantVector =
160 BaseVector::createConstant(var.inferType(), var, 100, pool_.get());
161 auto check = [&](auto& decoded) {
162 EXPECT_TRUE(decoded.isConstantMapping());
163 EXPECT_TRUE(!decoded.isIdentityMapping());
164 EXPECT_TRUE(decoded.nulls(nullptr) == nullptr);
165 for (int32_t i = 0; i < 100; i++) {
166 EXPECT_FALSE(decoded.isNullAt(i));
167 EXPECT_EQ(decoded.template valueAt<T>(i), value);
168 }
169 };
170
171 {
172 SelectivityVector selection(100);
173 DecodedVector decoded(*constantVector, selection);
174 check(decoded);
175 }
176
177 {
178 DecodedVector decoded(*constantVector);
179 check(decoded);
180 }
181 }
182
183 void testConstant(const VectorPtr& base, vector_size_t index) {
184 SCOPED_TRACE(base->toString());

Callers

nothing calls this directly

Calls 13

isBitNullFunction · 0.85
inferTypeMethod · 0.80
isConstantMappingMethod · 0.80
isIdentityMappingMethod · 0.80
equalValueAtMethod · 0.80
variantClass · 0.50
getMethod · 0.45
nullsMethod · 0.45
isNullAtMethod · 0.45
toStringMethod · 0.45
encodingMethod · 0.45
baseMethod · 0.45

Tested by

no test coverage detected