MCPcopy Create free account
hub / github.com/apache/arrow / RegisterInvalidInit

Function RegisterInvalidInit

cpp/src/arrow/compute/expression_test.cc:628–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628static 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.
658TEST(Expression, BindCallError) {

Callers 1

TESTFunction · 0.85

Calls 7

UnaryFunction · 0.85
GetFunctionRegistryFunction · 0.85
EmptyClass · 0.50
OKFunction · 0.50
InvalidFunction · 0.50
AddKernelMethod · 0.45
AddFunctionMethod · 0.45

Tested by

no test coverage detected