pitrou commented on code in PR #14043:
URL: https://github.com/apache/arrow/pull/14043#discussion_r1016251035


##########
cpp/src/arrow/compute/function_test.cc:
##########
@@ -351,5 +354,87 @@ TEST(ScalarAggregateFunction, DispatchExact) {
   ASSERT_TRUE(selected_kernel->signature->MatchesInputs(dispatch_args));
 }
 
+namespace {
+
+struct TestFunctionOptions : public FunctionOptions {
+  TestFunctionOptions();
+
+  static const char* kTypeName;
+};
+
+static auto kTestFunctionOptionsType =
+    internal::GetFunctionOptionsType<TestFunctionOptions>();
+
+TestFunctionOptions::TestFunctionOptions() : 
FunctionOptions(kTestFunctionOptionsType) {}
+
+const char* TestFunctionOptions::kTypeName = "test_options";
+
+}  // namespace
+
+TEST(FunctionExecutor, Basics) {
+  VectorFunction func("vector_test", Arity::Binary(), 
/*doc=*/FunctionDoc::Empty());
+  bool init_called = false;
+  ExecContext exec_ctx;
+  TestFunctionOptions options;
+  auto init =
+      [&init_called, &exec_ctx, &options](
+          KernelContext* kernel_ctx,
+          const KernelInitArgs& init_args) -> 
Result<std::unique_ptr<KernelState>> {
+    init_called = true;
+    if (&exec_ctx != kernel_ctx->exec_context()) {
+      return Status::Invalid("expected exec context not found in kernel 
context");
+    }
+    if (&options != init_args.options) {
+      return Status::Invalid("expected options not found in kernel init args");
+    }
+    return NULLPTR;
+  };
+  auto exec = [](KernelContext* ctx, const ExecSpan& args, ExecResult* out) {
+    DCHECK_EQ(2, args.values.size());

Review Comment:
   ASSERTs need a void-returning function, but I don't think EXPECTs do.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to