| 39 | constexpr char kTypeNameField[] = "_type_name"; |
| 40 | |
| 41 | Result<std::shared_ptr<StructScalar>> FunctionOptionsToStructScalar( |
| 42 | const FunctionOptions& options) { |
| 43 | std::vector<std::string> field_names; |
| 44 | std::vector<std::shared_ptr<Scalar>> values; |
| 45 | const auto* options_type = |
| 46 | dynamic_cast<const GenericOptionsType*>(options.options_type()); |
| 47 | if (!options_type) { |
| 48 | return Status::NotImplemented("serializing ", options.type_name(), |
| 49 | " to StructScalar"); |
| 50 | } |
| 51 | RETURN_NOT_OK(options_type->ToStructScalar(options, &field_names, &values)); |
| 52 | field_names.push_back(kTypeNameField); |
| 53 | const char* options_name = options.type_name(); |
| 54 | values.emplace_back( |
| 55 | new BinaryScalar(Buffer::Wrap(options_name, std::strlen(options_name)))); |
| 56 | return StructScalar::Make(std::move(values), std::move(field_names)); |
| 57 | } |
| 58 | |
| 59 | Result<std::unique_ptr<FunctionOptions>> FunctionOptionsFromStructScalar( |
| 60 | const StructScalar& scalar) { |
nothing calls this directly
no test coverage detected