| 47 | filter_(std::move(filter)) {} |
| 48 | |
| 49 | static Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 50 | const ExecNodeOptions& options) { |
| 51 | RETURN_NOT_OK(ValidateExecNodeInputs(plan, inputs, 1, "FilterNode")); |
| 52 | auto schema = inputs[0]->output_schema(); |
| 53 | |
| 54 | const auto& filter_options = checked_cast<const FilterNodeOptions&>(options); |
| 55 | |
| 56 | auto filter_expression = filter_options.filter_expression; |
| 57 | if (!filter_expression.IsBound()) { |
| 58 | ARROW_ASSIGN_OR_RAISE( |
| 59 | filter_expression, |
| 60 | filter_expression.Bind(*schema, plan->query_context()->exec_context())); |
| 61 | } |
| 62 | |
| 63 | if (filter_expression.type()->id() != Type::BOOL) { |
| 64 | return Status::TypeError("Filter expression must evaluate to bool, but ", |
| 65 | filter_expression.ToString(), " evaluates to ", |
| 66 | filter_expression.type()->ToString()); |
| 67 | } |
| 68 | return plan->EmplaceNode<FilterNode>(plan, std::move(inputs), std::move(schema), |
| 69 | std::move(filter_expression)); |
| 70 | } |
| 71 | |
| 72 | const char* kind_name() const override { return "FilterNode"; } |
| 73 |
nothing calls this directly
no test coverage detected