| 604 | |
| 605 | template <typename TypeOrSchema> |
| 606 | Result<Expression> BindImpl(Expression expr, const TypeOrSchema& in, |
| 607 | compute::ExecContext* exec_context) { |
| 608 | if (exec_context == nullptr) { |
| 609 | compute::ExecContext exec_context; |
| 610 | return BindImpl(std::move(expr), in, &exec_context); |
| 611 | } |
| 612 | |
| 613 | if (expr.literal()) return expr; |
| 614 | |
| 615 | if (const FieldRef* ref = expr.field_ref()) { |
| 616 | ARROW_ASSIGN_OR_RAISE(FieldPath path, ref->FindOne(in)); |
| 617 | |
| 618 | Expression::Parameter param = *expr.parameter(); |
| 619 | param.indices.resize(path.indices().size()); |
| 620 | std::copy(path.indices().begin(), path.indices().end(), param.indices.begin()); |
| 621 | ARROW_ASSIGN_OR_RAISE(auto field, path.Get(in)); |
| 622 | param.type = field->type(); |
| 623 | return Expression{std::move(param)}; |
| 624 | } |
| 625 | |
| 626 | auto call = *CallNotNull(expr); |
| 627 | for (auto& argument : call.arguments) { |
| 628 | ARROW_ASSIGN_OR_RAISE(argument, BindImpl(std::move(argument), in, exec_context)); |
| 629 | } |
| 630 | return BindNonRecursive(std::move(call), |
| 631 | /*insert_implicit_casts=*/true, exec_context); |
| 632 | } |
| 633 | |
| 634 | } // namespace |
| 635 |
no test coverage detected