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

Function Schema__metadata

r/src/schema.cpp:110–130  ·  view source on GitHub ↗

[[arrow::export]]

Source from the content-addressed store, hash-verified

108
109// [[arrow::export]]
110cpp11::writable::list Schema__metadata(const std::shared_ptr<arrow::Schema>& schema) {
111 auto meta = schema->metadata();
112 int64_t n = 0;
113 if (schema->HasMetadata()) {
114 n = meta->size();
115 }
116
117 cpp11::writable::list out(n);
118 std::vector<std::string> names_out(n);
119
120 for (int i = 0; i < n; i++) {
121 auto key = meta->key(i);
122 out[i] = cpp11::as_sexp(meta->value(i));
123 if (key == "r") {
124 Rf_classgets(out[i], arrow::r::data::classes_metadata_r);
125 }
126 names_out[i] = key;
127 }
128 out.names() = names_out;
129 return out;
130}
131
132std::shared_ptr<arrow::KeyValueMetadata> strings_to_kvm(cpp11::strings metadata) {
133 auto values = cpp11::as_cpp<std::vector<std::string>>(metadata);

Callers 1

_arrow_Schema__metadataFunction · 0.85

Calls 6

as_sexpFunction · 0.85
metadataMethod · 0.45
HasMetadataMethod · 0.45
sizeMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected