Skip to content

feat(c-glib): add fixed and variable closedness range GLib bindings - #2

Draft
hoeze-minion wants to merge 2 commits into
feat/arrow-range-extensionfrom
feat/arrow-range-glib
Draft

hoeze-minion wants to merge 2 commits into
feat/arrow-range-extensionfrom
feat/arrow-range-glib

Conversation

@hoeze-minion

@hoeze-minion hoeze-minion commented May 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add Arrow GLib (C) bindings for the two range canonical extension types,
arrow.fixed_closedness_range and arrow.variable_closedness_range.

This is stacked on the branch feat/arrow-range-extension
(apache#50028), which carries the C++/Python/spec work. Review and merge
that first; the diff here is only the GLib layer.

Changes

  • c_glib/arrow-glib/basic-data-type.{h,cpp}:

    • GArrowRangeClosed enum (left/right/both/neither), mirroring
      arrow::extension::RangeClosed.
    • GArrowFixedClosednessRangeDataType, wrapping
      arrow::extension::FixedClosednessRangeType. Provides
      garrow_fixed_closedness_range_data_type_new(value_type, closed, allow_unbounded)
      plus get_value_type / get_closed accessors.
    • GArrowVariableClosednessRangeDataType, wrapping
      arrow::extension::VariableClosednessRangeType. Provides
      garrow_variable_closedness_range_data_type_new(value_type, allow_unbounded)
      plus a get_value_type accessor. It takes no closed argument, because
      each value stores its own inclusivity.
    • Dispatch for both extension names in garrow_data_type_new_raw.
    • New API is marked GARROW_AVAILABLE_IN_26_0 / Since: 26.0.0.

    Modeled on the existing GArrowFixedShapeTensorDataType (parameterized) and
    GArrowUUIDDataType (extension base).

  • c_glib/test/test-fixed-closedness-range-data-type.rb and
    c_glib/test/test-variable-closedness-range-data-type.rb: Ruby tests for
    the GLib types.

Testing

Built arrow-glib against a local Arrow C++ install and ran the in-tree Ruby
test harness:

  • TestFixedClosednessRangeDataType: 11 / 11 pass (id, name, value_type,
    closed, to_s, all four closed values, the allow_unbounded=false path, and
    a C++ round trip through Schema/Field).
  • TestVariableClosednessRangeDataType: 6 / 6 pass (id, name, value_type,
    to_s, the allow_unbounded=false path, and the C++ round trip).

The full c_glib suite has no failures. Its only errors are pre-existing
missing-codec cases (gzip and zstd are not built in this C++ install), which
are unrelated to this change.

Note

Building arrow-glib requires the underlying Arrow C++ to be built with
-DARROW_ACERO=ON, since c_glib hard-requires arrow-acero.

Was AI used for this PR?

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Note that I made heavy use of AI to create this PR and copied many structures
from the existing GArrowFixedShapeTensorDataType and GArrowUUIDDataType.
I reviewed each change and hope the changes I made are meaningful.

Add GArrowFixedClosednessRangeDataType, the GLib binding for the
arrow.fixed_closedness_range canonical extension type: a bounded
interval over an orderable value type, with the inclusivity of its
bounds fixed at the type level via the GArrowRangeClosed enum. Also
adds a Ruby test covering construction, value_type, closed, the
extension name, and the C++ round-trip.
Add GArrowVariableClosednessRangeDataType, the GLib binding for the
arrow.variable_closedness_range canonical extension type. The
inclusivity of each bound is stored per value, so construction takes
no closed argument. A Ruby test covers construction, value_type, the
extension name, and the C++ round trip.
@Hoeze Hoeze changed the title feat(c-glib): add arrow.range GLib bindings feat(c-glib): add fixed and variable closedness range GLib bindings Sep 26, 2026
@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

If this is not a minor PR, could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions
github-actions Bot marked this pull request as draft September 26, 2026 23:07
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.

2 participants