Skip to content

GH-54687: [GLib] Add missing owner references to GBytes - #54883

Merged
kou merged 1 commit into
apache:mainfrom
kou:glib-buffer-data
Oct 21, 2026
Merged

kou merged 1 commit into
apache:mainfrom
kou:glib-buffer-data

Conversation

@kou

@kou kou commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Apache Arrow GLib uses g_byte_new_static() for zero-copy API. If owner objects are destroyed before GBytes, GBytess refer freed data.

What changes are included in this PR?

  • Use g_byte_new_with_free_func() instead to refer owner objects.
  • GParquetStatistics refers GParquetColumnChunkMetadata because GParquetColumnChunkMetadata owns min/max values.
  • gparquet_{,fixed_length_}byte_array_statistics_get_{min,max}(): Use (transfer full) instead of (transfer none) to avoid circular reference. Direct Apache Parquet GLib uses must call g_bytes_unref() manually. This is a backward incompatible change. GObject Introspection users don't care about this. Because GObject Introspection cares about this automatically.
  • Enable ASAN tests only on Linux.

Are these changes tested?

Yes.

Are there any user-facing changes?

This PR includes breaking changes to public APIs. The return value of the following functions must be freed by g_bytes_unref():

  • gparquet_byte_array_statistics_get_min()
  • gparquet_byte_array_statistics_get_max()
  • gparquet_fixed_length_byte_array_statistics_get_min()
  • gparquet_fixed_length_byte_array_statistics_get_max()

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Copilot AI balanced review requested due to automatic review settings October 21, 2026 02:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the awaiting committer review Awaiting committer review label Oct 21, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #54687 has been automatically assigned in GitHub to PR creator.

@kou

kou commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

@himotoyoshi Could you try this?

@himotoyoshi

Copy link
Copy Markdown

I tried this on macOS (arm64) with Ruby 3.4.1, and it fixes the problem:

irb> bytes = Arrow::StringArray.new(["hello world, a long-ish string"]).data_buffer.data
irb> GC.start
irb> bytes.to_s
=> "hello world, a long-ish string"

Thanks!

@kou

kou commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Thanks. I'll merge this.

@kou
kou merged commit 83cc149 into apache:main Oct 21, 2026
45 checks passed
@kou kou removed the awaiting committer review Awaiting committer review label Oct 21, 2026
@kou
kou deleted the glib-buffer-data branch October 21, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants