| 68 | } |
| 69 | |
| 70 | Result<std::shared_ptr<Buffer>> GenericOptionsType::Serialize( |
| 71 | const FunctionOptions& options) const { |
| 72 | #ifdef ARROW_IPC |
| 73 | ARROW_ASSIGN_OR_RAISE(auto scalar, FunctionOptionsToStructScalar(options)); |
| 74 | ARROW_ASSIGN_OR_RAISE(auto array, MakeArrayFromScalar(*scalar, 1)); |
| 75 | auto batch = |
| 76 | RecordBatch::Make(schema({field("", array->type())}), /*num_rows=*/1, {array}); |
| 77 | ARROW_ASSIGN_OR_RAISE(auto stream, io::BufferOutputStream::Create()); |
| 78 | ARROW_ASSIGN_OR_RAISE(auto writer, ipc::MakeFileWriter(stream, batch->schema())); |
| 79 | RETURN_NOT_OK(writer->WriteRecordBatch(*batch)); |
| 80 | RETURN_NOT_OK(writer->Close()); |
| 81 | return stream->Finish(); |
| 82 | #else |
| 83 | return Status::NotImplemented("IPC feature isn't enabled"); |
| 84 | #endif |
| 85 | } |
| 86 | |
| 87 | Result<std::unique_ptr<FunctionOptions>> GenericOptionsType::Deserialize( |
| 88 | const Buffer& buffer) const { |
nothing calls this directly
no test coverage detected