| 625 | } // namespace |
| 626 | |
| 627 | Result<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 | |
| 645 | namespace { |
| 646 |
no test coverage detected