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

Function getDataFromFile

bolt/exec/benchmarks/RowContainerSortBenchmark.cpp:75–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75std::vector<std::optional<StringView>> getDataFromFile() {
76 const std::string sample(getExampleFilePath("str_sort.parquet"));
77 auto rowType = ROW({"query_sig", "result_sig"}, {VARCHAR(), VARCHAR()});
78 auto pool = memory::memoryManager()->addLeafPool();
79 bytedance::bolt::dwio::common::ReaderOptions readerOptions{pool.get()};
80 bytedance::bolt::parquet::ParquetReader reader =
81 createReader(sample, readerOptions);
82 auto rowReaderOpts = getReaderOpts(rowType);
83 auto scanSpec = makeScanSpec(rowType);
84 rowReaderOpts.setScanSpec(scanSpec);
85 auto rowReader = reader.createRowReader(rowReaderOpts);
86 auto data = BaseVector::create(rowType, 50000, pool.get());
87 rowReader->next(50000, data);
88 auto querySigCol =
89 data->as<RowVector>()->childAt(0)->asFlatVector<StringView>();
90 auto resSigCol =
91 data->as<RowVector>()->childAt(1)->asFlatVector<StringView>();
92 std::vector<std::optional<StringView>> stdVector(querySigCol->size());
93 for (int i = 0; i < querySigCol->size(); i++) {
94 auto merge =
95 querySigCol->valueAt(i).getString() + resSigCol->valueAt(i).getString();
96 stdVector[i] = StringView(merge);
97 }
98 return stdVector;
99}
100
101std::vector<char*> store(
102 bolt::exec::RowContainer& rowContainer,

Callers 2

BM_STR_stdSortFunction · 0.85
BM_STR_timSortFunction · 0.85

Calls 15

ROWFunction · 0.85
memoryManagerFunction · 0.85
getReaderOptsFunction · 0.85
addLeafPoolMethod · 0.80
setScanSpecMethod · 0.80
childAtMethod · 0.80
getExampleFilePathFunction · 0.70
createReaderFunction · 0.70
makeScanSpecFunction · 0.70
createFunction · 0.50
StringViewClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected