Skip to content

GH-50027: [Format] Add fixed and variable closedness range canonical extension types - #53239

Open
Hoeze wants to merge 1 commit into
apache:mainfrom
Hoeze:feat/arrow-range-spec
Open

Hoeze wants to merge 1 commit into
apache:mainfrom
Hoeze:feat/arrow-range-spec

Conversation

@Hoeze

@Hoeze Hoeze commented Oct 11, 2026 •

Copy link
Copy Markdown

Rationale for this change

This PR adds the spec text for two range canonical extension types (#50027). It is cherry-picked from the C++ and Python prototype in #50028.


A range is an interval with a lower and an upper bound:

  • arrow.fixed_closedness_range: the closedness (left, right, both or neither) is a type parameter shared by all values. This fits discrete ranges such as PostgreSQL's int4range or daterange, and pandas' IntervalArray.
  • arrow.variable_closedness_range: the inclusivity of each bound is stored per value. Continuous ranges such as PostgreSQL's numrange or tstzrange need this, because one column can hold both [1, 5] and (1, 5).

The names follow the existing arrow.fixed_shape_tensor / arrow.variable_shape_tensor pair.

What changes are included in this PR?

Spec text for both types in CanonicalExtensions.rst.
Both use a Struct<lower: T, upper: T> storage, and the variable type adds two non-nullable booleans lower_inc and upper_inc.
T may be any orderable type, bounds are compared with the order of T, and only a null bound means an unbounded side.

Are these changes tested?

This PR changes only documentation.

Are there any user-facing changes?

Yes, two new canonical extension types in the format documentation. There are no breaking changes.

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

Add the spec text for arrow.fixed_closedness_range and
arrow.variable_closedness_range. The C++ and Python implementation
stays in a separate pull request.
@Hoeze
Hoeze marked this pull request as ready for review October 11, 2026 18:04
@Hoeze
Hoeze requested a review from pitrou as a code owner October 11, 2026 18:04
Copilot AI balanced review requested due to automatic review settings October 11, 2026 18:04

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.

🟡 Changes recommended

The specification incorrectly describes potentially unbounded ranges as bounded sets.

1 open finding
What changed in this PR

Adds canonical format specifications for fixed- and variable-closedness range extension types.

Changes:

  • Defines storage layouts, nullability, and range semantics.
  • Specifies closedness metadata and serialization rules.
File Description
docs/​source/​format/​CanonicalExtensions.rst Documents both canonical range extension types.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Fixed closedness range
======================

Fixed closedness range represents a bounded set (mathematical interval)
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