| 645 | namespace { |
| 646 | |
| 647 | Future<std::shared_ptr<Table>> DeclarationToTableImpl( |
| 648 | Declaration declaration, QueryOptions query_options, |
| 649 | ::arrow::internal::Executor* cpu_executor) { |
| 650 | ExecContext exec_ctx(query_options.memory_pool, cpu_executor, |
| 651 | query_options.function_registry); |
| 652 | std::shared_ptr<std::shared_ptr<Table>> output_table = |
| 653 | std::make_shared<std::shared_ptr<Table>>(); |
| 654 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<ExecPlan> exec_plan, |
| 655 | ExecPlan::Make(query_options, exec_ctx)); |
| 656 | TableSinkNodeOptions sink_options(output_table.get()); |
| 657 | sink_options.sequence_output = query_options.sequence_output; |
| 658 | sink_options.names = std::move(query_options.field_names); |
| 659 | Declaration with_sink = |
| 660 | Declaration::Sequence({declaration, {"table_sink", sink_options}}); |
| 661 | ARROW_RETURN_NOT_OK(with_sink.AddToPlan(exec_plan.get())); |
| 662 | ARROW_RETURN_NOT_OK(exec_plan->Validate()); |
| 663 | exec_plan->StartProducing(); |
| 664 | return exec_plan->finished().Then([exec_plan, output_table] { return *output_table; }); |
| 665 | } |
| 666 | |
| 667 | Future<std::vector<std::shared_ptr<RecordBatch>>> DeclarationToBatchesImpl( |
| 668 | Declaration declaration, QueryOptions options, |
no test coverage detected