* garrow_schema_get_metadata: * @schema: A #GArrowSchema. * * Returns: (element-type utf8 utf8) (nullable) (transfer full): The * metadata in the schema. * * It should be freed with g_hash_table_unref() when no longer needed. * * Since: 0.17.0 */
| 430 | * Since: 0.17.0 |
| 431 | */ |
| 432 | GHashTable * |
| 433 | garrow_schema_get_metadata(GArrowSchema *schema) |
| 434 | { |
| 435 | const auto arrow_schema = garrow_schema_get_raw(schema); |
| 436 | if (!arrow_schema->HasMetadata()) { |
| 437 | return NULL; |
| 438 | } |
| 439 | |
| 440 | auto arrow_metadata = arrow_schema->metadata(); |
| 441 | auto metadata = g_hash_table_new(g_str_hash, g_str_equal); |
| 442 | const auto n = arrow_metadata->size(); |
| 443 | for (int64_t i = 0; i < n; ++i) { |
| 444 | g_hash_table_insert(metadata, |
| 445 | const_cast<gchar *>(arrow_metadata->key(i).c_str()), |
| 446 | const_cast<gchar *>(arrow_metadata->value(i).c_str())); |
| 447 | } |
| 448 | return metadata; |
| 449 | } |
| 450 | |
| 451 | /** |
| 452 | * garrow_schema_with_metadata: |
nothing calls this directly
no test coverage detected