MCPcopy Create free account
hub / github.com/apache/arrow / ScanOnly

Function ScanOnly

cpp/src/arrow/dataset/scanner_benchmark.cc:143–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void ScanOnly(
144 size_t num_batches, size_t batch_size, const std::string& factory_name,
145 std::function<Result<std::shared_ptr<acero::ExecNodeOptions>>(size_t, size_t)>
146 options_factory) {
147 // ensure arrow::dataset node factories are in the registry
148 ::arrow::dataset::internal::Initialize();
149
150 RecordBatchVector batches = GetBatches(num_batches, batch_size);
151
152 std::shared_ptr<Dataset> dataset =
153 std::make_shared<InMemoryDataset>(GetSchema(), batches);
154
155 ASSERT_OK_AND_ASSIGN(std::shared_ptr<acero::ExecNodeOptions> node_options,
156 options_factory(num_batches, batch_size));
157
158 // construct the plan
159 acero::Declaration scan(factory_name, std::move(node_options));
160
161 ASSERT_OK_AND_ASSIGN(std::shared_ptr<Table> collected,
162 acero::DeclarationToTable(std::move(scan)));
163
164 ASSERT_GT(collected->num_rows(), 0);
165 if (factory_name == "scan") {
166 ASSERT_EQ(collected->num_columns(), 6);
167 } else if (factory_name == "scan2") {
168 ASSERT_EQ(collected->num_columns(), 2);
169 }
170}
171
172static constexpr int kScanIdx = 0;
173static constexpr int kScanV2Idx = 1;

Callers 1

ScanOnlyBenchFunction · 0.85

Calls 7

GetBatchesFunction · 0.85
DeclarationToTableFunction · 0.85
InitializeFunction · 0.70
GetSchemaFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
num_rowsMethod · 0.45
num_columnsMethod · 0.45

Tested by

no test coverage detected