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

Method encodedTest

bolt/expression/tests/ArrayViewTest.cpp:153–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 void encodedTest() {
154 std::vector<std::vector<std::optional<int32_t>>> intArray = {
155 {1},
156 {2, 3},
157 };
158 VectorPtr arrayVector = makeNullableArrayVector(intArray);
159 // Wrap in dictionary.
160 auto vectorSize = arrayVector->size();
161 BufferPtr indices =
162 AlignedBuffer::allocate<vector_size_t>(vectorSize, pool_.get());
163 auto rawIndices = indices->asMutable<vector_size_t>();
164 // Assign indices such that array is reversed.
165 for (size_t i = 0; i < vectorSize; ++i) {
166 rawIndices[i] = vectorSize - 1 - i;
167 }
168 arrayVector = BaseVector::wrapInDictionary(
169 BufferPtr(nullptr), indices, vectorSize, arrayVector);
170
171 DecodedVector decoded;
172 exec::VectorReader<Array<int32_t>> reader(decode(decoded, *arrayVector));
173
174 ASSERT_EQ(read(reader, 0).size(), 2);
175 ASSERT_EQ(read(reader, 1).size(), 1);
176 }
177
178 void iteratorDifferenceTest() {
179 std::vector<std::vector<std::optional<int32_t>>> intArray{

Callers

nothing calls this directly

Calls 5

wrapInDictionaryFunction · 0.85
decodeFunction · 0.70
readFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected