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

Method Serialize

cpp/src/arrow/compute/function_internal.cc:70–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70Result<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
87Result<std::unique_ptr<FunctionOptions>> GenericOptionsType::Deserialize(
88 const Buffer& buffer) const {

Callers

nothing calls this directly

Calls 8

MakeFunction · 0.50
schemaFunction · 0.50
fieldFunction · 0.50
NotImplementedFunction · 0.50
typeMethod · 0.45
WriteRecordBatchMethod · 0.45
CloseMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected