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

Function createNestedMapMemReader

c++/test/TestReader.cc:360–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358 std::make_tuple(std::vector<uint32_t>{1000}, std::list<uint64_t>{1000}, false)));
359
360 std::unique_ptr<Reader> createNestedMapMemReader(MemoryOutputStream& memStream,
361 const std::vector<uint32_t>& stripesToPrefetch,
362 const std::list<uint64_t>& columnsToPrefetch,
363 bool prefetchTwice) {
364 MemoryPool* pool = getDefaultPool();
365
366 auto type = std::unique_ptr<Type>(
367 Type::buildTypeFromString("struct<"
368 "id:int,"
369 "single_map:map<string,string>,"
370 "nested_map:map<string,map<string,map<string,string>>>"
371 ">"));
372 WriterOptions options;
373 options.setStripeSize(1024 * 1024)
374 .setCompressionBlockSize(1024)
375 .setMemoryBlockSize(64)
376 .setCompression(CompressionKind_NONE)
377 .setMemoryPool(pool)
378 .setRowIndexStride(1000);
379
380 auto writer = createWriter(*type, &memStream, options);
381 auto batch = writer->createRowBatch(100);
382 auto& type0StructBatch = dynamic_cast<StructVectorBatch&>(*batch);
383 auto& type1LongBatch = dynamic_cast<LongVectorBatch&>(*type0StructBatch.fields[0]);
384 auto& type2MapBatch = dynamic_cast<MapVectorBatch&>(*type0StructBatch.fields[1]);
385 auto& type3StringBatch = dynamic_cast<StringVectorBatch&>(*type2MapBatch.keys);
386 auto& type4StringBatch = dynamic_cast<StringVectorBatch&>(*type2MapBatch.elements);
387 auto& type5MapBatch = dynamic_cast<MapVectorBatch&>(*type0StructBatch.fields[2]);
388 auto& type6StringBatch = dynamic_cast<StringVectorBatch&>(*type5MapBatch.keys);
389 auto& type7MapBatch = dynamic_cast<MapVectorBatch&>(*type5MapBatch.elements);
390 auto& type8StringBatch = dynamic_cast<StringVectorBatch&>(*type7MapBatch.keys);
391 auto& type9MapBatch = dynamic_cast<MapVectorBatch&>(*type7MapBatch.elements);
392 auto& type10StringBatch = dynamic_cast<StringVectorBatch&>(*type9MapBatch.keys);
393 auto& type11StringBatch = dynamic_cast<StringVectorBatch&>(*type9MapBatch.elements);
394
395 std::string map2Key = "k0";
396 std::string map2Element = "v0";
397 std::string map5Key = "k1";
398 std::string map7Key = "k2";
399 std::string map9Key = "k3";
400 std::string map9Element = "v3";
401
402 type11StringBatch.numElements = 1;
403 type11StringBatch.data[0] = const_cast<char*>(map9Element.c_str());
404 type11StringBatch.length[0] = static_cast<int64_t>(map9Element.length());
405
406 type10StringBatch.numElements = 1;
407 type10StringBatch.data[0] = const_cast<char*>(map9Key.c_str());
408 type10StringBatch.length[0] = static_cast<int64_t>(map9Key.length());
409
410 type9MapBatch.numElements = 1;
411 type9MapBatch.offsets[0] = 0;
412 type9MapBatch.offsets[1] = 1;
413
414 type8StringBatch.numElements = 1;
415 type8StringBatch.data[0] = const_cast<char*>(map7Key.c_str());
416 type8StringBatch.length[0] = static_cast<int64_t>(map7Key.length());
417

Callers 1

TEST_PFunction · 0.85

Calls 10

getDefaultPoolFunction · 0.85
lengthMethod · 0.80
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