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

Function ExecNode_Scan

r/src/compute-exec.cpp:278–309  ·  view source on GitHub ↗

[[dataset::export]]

Source from the content-addressed store, hash-verified

276
277// [[dataset::export]]
278std::shared_ptr<acero::ExecNode> ExecNode_Scan(
279 const std::shared_ptr<acero::ExecPlan>& plan,
280 const std::shared_ptr<ds::Dataset>& dataset,
281 const std::shared_ptr<compute::Expression>& filter, cpp11::list projection) {
282 arrow::dataset::internal::Initialize();
283
284 // TODO: pass in FragmentScanOptions
285 auto options = std::make_shared<ds::ScanOptions>();
286
287 options->use_threads = arrow::r::GetBoolOption("arrow.use_threads", true);
288 options->dataset_schema = dataset->schema();
289
290 // This filter is only used for predicate pushdown;
291 // you still need to pass it to a FilterNode after to handle any other components
292 options->filter = *filter;
293
294 // ScanNode needs to know which fields to materialize.
295 // It will pull them from this projection to prune the scan,
296 // but you still need to Project after
297 std::vector<compute::Expression> exprs;
298 for (SEXP expr : projection) {
299 auto expr_ptr = cpp11::as_cpp<std::shared_ptr<compute::Expression>>(expr);
300 exprs.push_back(*expr_ptr);
301 }
302 cpp11::strings field_names(projection.attr(R_NamesSymbol));
303 options->projection = call(
304 "make_struct", std::move(exprs),
305 compute::MakeStructOptions{cpp11::as_cpp<std::vector<std::string>>(field_names)});
306
307 return MakeExecNodeOrStop("scan", plan.get(), {},
308 ds::ScanNodeOptions{dataset, options});
309}
310
311// [[dataset::export]]
312void ExecPlan_Write(

Callers 1

_arrow_ExecNode_ScanFunction · 0.85

Calls 7

GetBoolOptionFunction · 0.85
MakeExecNodeOrStopFunction · 0.85
push_backMethod · 0.80
InitializeFunction · 0.50
callFunction · 0.50
schemaMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected