| 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{ |
nothing calls this directly
no test coverage detected