Skip to content

Commit

Permalink
apacheGH-40493: [GLib][Ruby] Add GArrowStreamDecoder
Browse files Browse the repository at this point in the history
This is the bindings of
`arrow::ipc::StreamDecoder`. `arrow::ipc::StreamDecoder` is useful to
integrate async input.
  • Loading branch information
kou committed Sep 19, 2024
1 parent 9576a41 commit 9095fbf
Show file tree
Hide file tree
Showing 11 changed files with 949 additions and 18 deletions.
2 changes: 1 addition & 1 deletion c_glib/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
source "https://rubygems.org/"

gem "test-unit"
gem "gobject-introspection", ">= 4.1.1"
gem "gobject-introspection", ">= 4.2.3"
18 changes: 18 additions & 0 deletions c_glib/arrow-glib/internal-hash-table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,21 @@ garrow_internal_hash_table_to_metadata(GHashTable *metadata)
&arrow_metadata);
return arrow_metadata;
}

static inline GHashTable *
garrow_internal_hash_table_from_metadata(
const std::shared_ptr<arrow::KeyValueMetadata> &arrow_metadata)
{
auto metadata = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
const auto &keys = arrow_metadata->keys();
const auto &values = arrow_metadata->values();
auto n = arrow_metadata->size();
for (int64_t i = 0; i < n; ++i) {
const auto &key = keys[i];
const auto &value = values[i];
g_hash_table_insert(metadata,
g_strndup(key.data(), key.size()),
g_strndup(value.data(), value.size()));
}
return metadata;
}
Loading

0 comments on commit 9095fbf

Please sign in to comment.