[[arrow::export]]
| 108 | |
| 109 | // [[arrow::export]] |
| 110 | cpp11::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 | |
| 132 | std::shared_ptr<arrow::KeyValueMetadata> strings_to_kvm(cpp11::strings metadata) { |
| 133 | auto values = cpp11::as_cpp<std::vector<std::string>>(metadata); |
no test coverage detected