Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/examples/arrow/acero_register_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ arrow::Status RunComputeRegister(int argc, char** argv) {
// FunctionOptions for which serialization is not supported.
auto expr = cp::call(name, {}, options);
auto maybe_serialized = cp::Serialize(expr);
std::cerr << maybe_serialized.status().ToString() << std::endl;
std::cout << "Serializing an expression with ExampleFunctionOptions fails as expected: "
<< maybe_serialized.status().ToString() << std::endl;

auto exec_registry = ac::default_exec_factory_registry();
ARROW_RETURN_NOT_OK(
Expand Down
9 changes: 9 additions & 0 deletions cpp/src/arrow/compute/expression_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,15 @@ TEST(Expression, Filter) {
])");
}

TEST(Expression, SerializeCustomOptions) {
// GH-30923: custom FunctionOptionsType cannot be serialized
auto expr = call("widgetify", {}, std::make_shared<WidgetifyOptions>());
EXPECT_RAISES_WITH_MESSAGE_THAT(
NotImplemented,
HasSubstr("FunctionOptions type 'widgetify' is not supported: only built-in"),
Serialize(expr));
}

TEST(Expression, SerializationRoundTrips) {
auto ExpectRoundTrips = [](const Expression& expr) {
ASSERT_OK_AND_ASSIGN(auto serialized, Serialize(expr));
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/arrow/compute/function_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ Result<std::shared_ptr<StructScalar>> FunctionOptionsToStructScalar(
const auto* options_type =
dynamic_cast<const GenericOptionsType*>(options.options_type());
if (!options_type) {
return Status::NotImplemented("serializing ", options.type_name(),
" to StructScalar");
return Status::NotImplemented("Serialization of FunctionOptions type '",
options.type_name(),
"' is not supported: only built-in options types "
"can be serialized");
}
RETURN_NOT_OK(options_type->ToStructScalar(options, &field_names, &values));
field_names.push_back(kTypeNameField);
Expand Down
Loading