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

Function ExecNode_Scan

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

[[dataset::export]]

Source from the content-addressed store, hash-verified

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