Skip to content

[Ruby] Add builder API for red-arrow-format #50382

Open
2 of 2 issues completed
Open

Description

@kou

Describe the enhancement requested

red-arrow-format is a pure Ruby Apache Arrow reader/writer implementation. It can write Apache Arrow IPC file/streaming format data but users need to build Apache Arrow in-memory layout data by themselves. For example, [1, 2, 3].pack("l") + padding for int32 array. It's inconvenient. We should provide builder API for easy to build Apache Arrow in-memory layout data.

Component(s)

Ruby

Activity

  1. emecii commented on Sep 9, 2026

    @emecii
    Contributor

    take

    I’d like to work on this. Since ArrowFormat::ArrayBuilder already exists internally and #51214 added schema-aware RecordBatch construction, would exposing a public builder for primitive, string, and null-containing arrays first—while deferring nested, dictionary, and union arrays—match the intended scope?

  2. kou commented on Sep 9, 2026

    @kou
    MemberAuthor

    I want to add support for all types (including nested, dictionary and so on) before we work on this because we may need different API for non primitive types. If we defer these types, we may design inconsistent API.

    Could you work on other types before this?

  3. emecii commented on Sep 9, 2026

    @emecii
    Contributor

    Yes. I’ll map the builder behavior across nested, dictionary, union, and primitive types first, then propose one consistent public API and test matrix here before implementing it.

  4. emecii commented on Sep 9, 2026

    @emecii
    Contributor

    I mapped the current ArrowFormat type families. I suggest one explicit-type path for every represented type:

    ArrowFormat::ArrayBuilder.build(values, type: nil)
    ArrowFormat::Array.build(values, type: nil) # delegate

    Inference would stay conservative; empty/all-null values and ambiguous Hash values would require type:. Dictionary arrays also need a stateful ArrayBuilder.new(type:) API so memo/delta state can survive multiple finish calls.

    Two scope questions before I implement: does “all types” mean the existing ArrowFormat::Type subclasses, or also currently missing IPC types such as run-end encoded and view arrays? And should the stateful dictionary API ship together with the batch API?

  5. kou commented on Sep 9, 2026

    @kou
    MemberAuthor

    I want to use ArrowFormat::Int32Array.new(values) like API instead of ArrowFormat::Array.build(values, type: :int32) like API for explicit type build API because Ruby is an object oriented language.

    does “all types” mean the existing ArrowFormat::Type subclasses, or also currently missing IPC types such as run-end encoded and view arrays?

    The former.

    For example, we don't have ArrowFormat::ListArray.new(type, values) like API for now. We need to work on it as a separated task (separated issue and separated PR) before this.

    And should the stateful dictionary API ship together with the batch API?

    We can work on them as separated tasks.

  6. emecii commented on Sep 9, 2026

    @emecii
    Contributor

    Opened and claimed #51262 for the separate ArrowFormat::ListArray.new(type, values) prerequisite. I’ll keep the dictionary state API separate as suggested.

  7. added a commit that references this issue on Sep 11, 2026
  8. added a commit that references this issue on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions