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

Function DeclarationToSchema

cpp/src/arrow/acero/exec_plan.cc:627–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625} // namespace
626
627Result<std::shared_ptr<Schema>> DeclarationToSchema(const Declaration& declaration,
628 FunctionRegistry* function_registry) {
629 // We pass in the default memory pool and the CPU executor but nothing we are doing
630 // should be starting new thread tasks or making large allocations.
631 ExecContext exec_context(default_memory_pool(), ::arrow::internal::GetCpuThreadPool(),
632 function_registry);
633 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<ExecPlan> exec_plan,
634 ExecPlan::Make(exec_context));
635 ARROW_ASSIGN_OR_RAISE(ExecNode * last_node, declaration.AddToPlan(exec_plan.get()));
636 ARROW_ASSIGN_OR_RAISE(last_node, EnsureSink(last_node, exec_plan.get()));
637 ARROW_RETURN_NOT_OK(exec_plan->Validate());
638 if (last_node->inputs().size() != 1) {
639 // Every sink node today has exactly one input
640 return Status::Invalid("Unexpected sink node with more than one input");
641 }
642 return last_node->inputs()[0]->output_schema();
643}
644
645namespace {
646

Callers 1

GetPlanSchemaMethod · 0.85

Calls 10

default_memory_poolFunction · 0.85
GetCpuThreadPoolFunction · 0.85
EnsureSinkFunction · 0.85
AddToPlanMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
MakeFunction · 0.50
InvalidFunction · 0.50
getMethod · 0.45
ValidateMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected