| 626 | } |
| 627 | |
| 628 | static Status RegisterInvalidInit() { |
| 629 | const std::string name = "invalid_init"; |
| 630 | struct CastableFunction : public ScalarFunction { |
| 631 | using ScalarFunction::ScalarFunction; |
| 632 | |
| 633 | Result<const Kernel*> DispatchBest(std::vector<TypeHolder>* types) const override { |
| 634 | return Status::Invalid("Shouldn't call DispatchBest on this function"); |
| 635 | } |
| 636 | }; |
| 637 | auto func = |
| 638 | std::make_shared<CastableFunction>(name, Arity::Unary(), FunctionDoc::Empty()); |
| 639 | |
| 640 | auto func_exec = [](KernelContext*, const ExecSpan&, ExecResult*) -> Status { |
| 641 | return Status::OK(); |
| 642 | }; |
| 643 | auto func_init = [](KernelContext*, |
| 644 | const KernelInitArgs&) -> Result<std::unique_ptr<KernelState>> { |
| 645 | return Status::Invalid("Invalid Init"); |
| 646 | }; |
| 647 | |
| 648 | ScalarKernel kernel({int64()}, int64(), func_exec, func_init); |
| 649 | ARROW_RETURN_NOT_OK(func->AddKernel(kernel)); |
| 650 | |
| 651 | auto registry = GetFunctionRegistry(); |
| 652 | ARROW_RETURN_NOT_OK(registry->AddFunction(std::move(func))); |
| 653 | |
| 654 | return Status::OK(); |
| 655 | } |
| 656 | |
| 657 | // GH-47268: The bad status in call binding is discarded. |
| 658 | TEST(Expression, BindCallError) { |
no test coverage detected