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

Function GetSchemaMetadata

cpp/src/parquet/arrow/writer.cc:110–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110Status GetSchemaMetadata(const ::arrow::Schema& schema, ::arrow::MemoryPool* pool,
111 const ArrowWriterProperties& properties,
112 std::shared_ptr<const KeyValueMetadata>* out) {
113 if (!properties.store_schema()) {
114 *out = nullptr;
115 return Status::OK();
116 }
117
118 static const std::string kArrowSchemaKey = "ARROW:schema";
119 std::shared_ptr<KeyValueMetadata> result;
120 if (schema.metadata()) {
121 result = schema.metadata()->Copy();
122 } else {
123 result = ::arrow::key_value_metadata({}, {});
124 }
125
126 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> serialized,
127 ::arrow::ipc::SerializeSchema(schema, pool));
128
129 // The serialized schema is not UTF-8, which is required for Thrift
130 std::string schema_as_string = serialized->ToString();
131 std::string schema_base64 = ::arrow::util::base64_encode(schema_as_string);
132 result->Append(kArrowSchemaKey, std::move(schema_base64));
133 *out = std::move(result);
134 return Status::OK();
135}
136
137// Manages writing nested parquet columns with support for all nested types
138// supported by parquet.

Callers 1

OpenMethod · 0.85

Calls 9

key_value_metadataFunction · 0.85
store_schemaMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
SerializeSchemaFunction · 0.50
metadataMethod · 0.45
CopyMethod · 0.45
ToStringMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected