A sink node that accumulates inputs, then sorts them before emitting them.
| 448 | |
| 449 | // A sink node that accumulates inputs, then sorts them before emitting them. |
| 450 | static Result<ExecNode*> MakeSort(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 451 | const ExecNodeOptions& options) { |
| 452 | RETURN_NOT_OK(ValidateExecNodeInputs(plan, inputs, 1, "OrderBySinkNode")); |
| 453 | |
| 454 | const auto& sink_options = checked_cast<const OrderBySinkNodeOptions&>(options); |
| 455 | if (sink_options.backpressure.should_apply_backpressure()) { |
| 456 | return Status::Invalid("Backpressure cannot be applied to an OrderBySinkNode"); |
| 457 | } |
| 458 | RETURN_NOT_OK(ValidateOrderByOptions(sink_options)); |
| 459 | ARROW_ASSIGN_OR_RAISE( |
| 460 | std::unique_ptr<OrderByImpl> impl, |
| 461 | OrderByImpl::MakeSort(plan->query_context()->exec_context(), |
| 462 | inputs[0]->output_schema(), sink_options.sort_options)); |
| 463 | return plan->EmplaceNode<OrderBySinkNode>(plan, std::move(inputs), std::move(impl), |
| 464 | sink_options.generator); |
| 465 | } |
| 466 | |
| 467 | static Status ValidateCommonOrderOptions(const SinkNodeOptions& options) { |
| 468 | if (options.backpressure.should_apply_backpressure()) { |
nothing calls this directly
no test coverage detected