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

Method Serialize

cpp/src/arrow/extension/fixed_shape_tensor.cc:73–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73std::string FixedShapeTensorType::Serialize() const {
74 JsonWriter writer;
75
76 writer.StartObject();
77
78 writer.Key("shape");
79 writer.StartArray();
80 for (auto v : shape_) {
81 writer.Int64(v);
82 }
83 writer.EndArray();
84
85 if (!permutation_.empty()) {
86 writer.Key("permutation");
87 writer.StartArray();
88 for (auto v : permutation_) {
89 writer.Int64(v);
90 }
91 writer.EndArray();
92 }
93
94 if (!dim_names_.empty()) {
95 writer.Key("dim_names");
96 writer.StartArray();
97 for (const auto& v : dim_names_) {
98 writer.String(v);
99 }
100 writer.EndArray();
101 }
102
103 writer.EndObject();
104
105 Result<std::string_view> json = writer.GetString();
106 // can only fail in OutOfMemory scenarios
107 ARROW_CHECK_OK(json.status());
108 return std::string(*json);
109}
110
111Result<std::shared_ptr<DataType>> FixedShapeTensorType::Deserialize(
112 std::shared_ptr<DataType> storage_type, const std::string& serialized_data) const {

Callers

nothing calls this directly

Calls 10

StartObjectMethod · 0.45
KeyMethod · 0.45
StartArrayMethod · 0.45
Int64Method · 0.45
EndArrayMethod · 0.45
emptyMethod · 0.45
StringMethod · 0.45
EndObjectMethod · 0.45
GetStringMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected