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

Function garrow_schema_get_metadata

c_glib/arrow-glib/schema.cpp:432–449  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

430 * Since: 0.17.0
431 */
432GHashTable *
433garrow_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:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected