MCPcopy Create free account
hub / github.com/apache/orc / createNestedListMemReader

Function createNestedListMemReader

c++/test/TestReader.cc:158–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 std::unique_ptr<Reader> createNestedListMemReader(MemoryOutputStream& memStream,
159 const std::vector<uint32_t>& stripesToPrefetch,
160 const std::list<uint64_t>& columnsToPrefetch,
161 bool prefetchTwice) {
162 MemoryPool* pool = getDefaultPool();
163
164 auto type = std::unique_ptr<Type>(
165 Type::buildTypeFromString("struct<"
166 "int_array:array<int>,"
167 "int_array_array_array:array<array<array<int>>>"
168 ">"));
169 WriterOptions options;
170 options.setStripeSize(1024 * 1024)
171 .setCompressionBlockSize(1024)
172 .setMemoryBlockSize(64)
173 .setCompression(CompressionKind_NONE)
174 .setMemoryPool(pool)
175 .setRowIndexStride(1000);
176
177 auto writer = createWriter(*type, &memStream, options);
178 auto batch = writer->createRowBatch(100);
179 auto& type0StructBatch = dynamic_cast<StructVectorBatch&>(*batch);
180 auto& type1ListBatch = dynamic_cast<ListVectorBatch&>(*type0StructBatch.fields[0]);
181 auto& type2LongBatch = dynamic_cast<LongVectorBatch&>(*type1ListBatch.elements);
182 auto& type3ListBatch = dynamic_cast<ListVectorBatch&>(*type0StructBatch.fields[1]);
183 auto& type4ListBatch = dynamic_cast<ListVectorBatch&>(*type3ListBatch.elements);
184 auto& type5ListBatch = dynamic_cast<ListVectorBatch&>(*type4ListBatch.elements);
185 auto& type6LongBatch = dynamic_cast<LongVectorBatch&>(*type5ListBatch.elements);
186
187 type6LongBatch.numElements = 3;
188 type6LongBatch.data[0] = 1;
189 type6LongBatch.data[1] = 2;
190 type6LongBatch.data[2] = 3;
191
192 type5ListBatch.numElements = 3;
193 type5ListBatch.offsets[0] = 0;
194 type5ListBatch.offsets[1] = 1;
195 type5ListBatch.offsets[2] = 2;
196 type5ListBatch.offsets[3] = 3;
197
198 type4ListBatch.numElements = 3;
199 type4ListBatch.offsets[0] = 0;
200 type4ListBatch.offsets[1] = 1;
201 type4ListBatch.offsets[2] = 2;
202 type4ListBatch.offsets[3] = 3;
203
204 type3ListBatch.numElements = 1;
205 type3ListBatch.offsets[0] = 0;
206 type3ListBatch.offsets[1] = 3;
207
208 type2LongBatch.numElements = 2;
209 type2LongBatch.data[0] = -1;
210 type2LongBatch.data[1] = -2;
211
212 type1ListBatch.numElements = 1;
213 type1ListBatch.offsets[0] = 0;
214 type1ListBatch.offsets[1] = 2;
215

Callers 1

TEST_PFunction · 0.85

Calls 9

getDefaultPoolFunction · 0.85
preBufferMethod · 0.80
createWriterFunction · 0.70
createReaderFunction · 0.70
addMethod · 0.65
closeMethod · 0.65
getLengthMethod · 0.65
createRowBatchMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected