412 Commits
Author SHA1 Message Date
Raúl Cumplido e304e13b68 MINOR: [Release] Update versions for 27.0.0-SNAPSHOT 2026-10-13 12:43:24 +02:00
Edmond AbrahamandSutou Kouhei c68e0aa1fd GH-52021: [Ruby] Add support for sliced arrays in MemoryView (#52286)
### Rationale for this change

MemoryView export of `Arrow::PrimitiveArray` didn't support arrays with non-zero offset (sliced arrays). For example, exporting `Arrow::Int32Array.new([0, 1, 2, 3]).slice(1, 3)` returned wrong values because the data pointer was advanced by `offset` bytes instead of `offset * byte width` bytes.

### What changes are included in this PR?

* Use `offset * bit width / 8` as the byte offset of the data pointer. This supports sliced fixed-width arrays.
* Support sliced boolean arrays only when the offset is byte aligned. MemoryView can't represent a bit offset.
* Implement `available_p` for `Arrow::PrimitiveArray`. It returns `false` for arrays that can't be represented by MemoryView: unsupported types and boolean arrays with not byte aligned offset.

### Are these changes tested?

Ran the complete `test-memory-view.rb` file through the native Ruby/Fiddle interface using Ruby 3.2.3, Fiddle 1.1.8, and Arrow C++/GLib 25.0.1.

The original MemoryView implementation in the 25.0.1 release is identical to the current checkout. The extension was rebuilt with this PR's updated `memory-view.cpp`.

- Revised complete test file: 29 tests, 31 assertions, 0 failures, 0 errors, 0 omissions.
- Both new Boolean cases fail against the previous PR implementation and pass after the revision.
- `git diff --check` passes.

The full repository test suite and a complete build of the 26.0.0-SNAPSHOT dependencies were not run.

### Are there any user-facing changes?

* Sliced fixed-width arrays and byte-aligned sliced boolean arrays can be exported by MemoryView.
* `rb_memory_view_available_p()` returns `false` for unsupported arrays.

### Was AI used for this PR?

AI assisted with the investigation, implementation, regression tests, validation, and PR description.

**PR code and description written by:**

- [ ] Human
- [x] AI

**Reviewed before submission by:**

- [ ] Human
- [x] AI
- [ ] Not reviewed

* GitHub Issue: #52021

Lead-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-10-09 10:01:12 +09:00
Yifan Chen 1f789ffd70 GH-51273: [Ruby] Add FixedSizeListArray values constructor (#51274)
### Rationale for this change

GH-50382 requests explicit value constructors for all existing `ArrowFormat::Type` subclasses before the broader builder API is exposed. Fixed-size lists still require callers to manually construct the parent validity buffer and flattened child array.

This is the focused fixed-size-list prerequisite requested in the GH-50382 maintainer discussion. It is distinct from variable-size `ListArray` support in GH-51262.

### What changes are included in this PR?

- Add `ArrowFormat::FixedSizeListArray.new(type, values)` while preserving the existing low-level four-argument constructor.
- Build the parent validity bitmap and the child array from nested Ruby values.
- Preserve exactly `type.size` child slots for null parent lists.
- Reject non-null lists whose size differs from the declared fixed size.
- Delegate child construction to the declared child field type.
- Add focused coverage for typed construction, parent and child nulls, invalid sizes, empty input, and the low-level constructor.

### Are these changes tested?

Yes.

```console
RUBYLIB=/opt/homebrew/lib/ruby/gems/4.0.0/gems/red-arrow-25.0.1/lib GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0 bundle exec ruby test/run.rb test-fixed-size-list-array.rb
# 6 tests, 12 assertions, 0 failures, 0 errors

RUBYLIB=/opt/homebrew/lib/ruby/gems/4.0.0/gems/red-arrow-25.0.1/lib GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0 bundle exec rake test
# 696 tests, 705 assertions, 0 failures, 0 errors
```

I also wrote an Arrow IPC file containing `[[1, 2], nil, [3, nil]]` with the new constructor and loaded it with the native Arrow reader; the values round-tripped unchanged.

The tests use the current `red-arrow-format` sources with the locally installed Arrow 25.0.1 native extension. Upstream CI remains authoritative for the matching main-branch native runtime.

### Are there any user-facing changes?

Yes. `ArrowFormat::FixedSizeListArray` gains a two-argument values constructor. The existing low-level constructor remains supported.

### AI assistance disclosure

OpenAI Codex assisted with issue research, implementation, test generation, validation commands, and drafting this pull request. The submitted behavior is supported by the focused regression, full package suite, and IPC round-trip results above.
* GitHub Issue: #51273

Lead-authored-by: Yifan Chen <emecii23@gmail.com>
Co-authored-by: Yifan Chen <30335308+emecii@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-09-24 14:56:09 +09:00
Yifan Chen 0087bae0b2 GH-51271: [Ruby] Fix Date values in ArrowFormat::Date32Array (#51272)
### Rationale for this change

`ArrowFormat::Date32Array` currently stores `Date#day`, the day of the month, for Ruby `Date` values. Arrow Date32 values are signed day offsets from the Unix epoch, so this can silently produce incorrect data. The same conversion is used by `ArrowFormat::Array.build` when it infers Date32.

### What changes are included in this PR?

* Convert Ruby `Date` values from their Julian day to the Unix epoch day offset.
* Cover dates before, at, and after the Unix epoch, including nulls.
* Make the ArrayBuilder regression assert the encoded payload instead of comparing two arrays built through the same conversion path.

### Are these changes tested?

Yes. The full `red-arrow-format` suite passes locally: 691 tests and 695 assertions. The official rake runner used the current pure-Ruby sources with the locally installed Arrow 25.0.1 native extension; the local system does not have the Arrow C++ 26 dependency needed to build the native Ruby extension from `main`.

### Are there any user-facing changes?

Yes. Ruby `Date` values now produce specification-compliant Date32 day offsets.

**This PR contains a "Critical Fix".** It fixes incorrect Date32 data produced from Ruby `Date` values.

### AI assistance

AI assistance was used to investigate the defect, draft the focused implementation and tests, and run the verification described above. No human review is claimed.

* GitHub Issue: #51271

Authored-by: Yifan Chen <30335308+emecii@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-09-11 10:13:10 +09:00
Yifan Chen 4053d6efa5 GH-51262: [Ruby] Add ListArray values constructor (#51263)
### Rationale for this change

GH-50382 identified list arrays as a prerequisite for a consistent public typed-array builder API. This adds the separately requested list constructor.

### What changes are included in this PR?

* Add `ArrowFormat::ListArray.new(type, values)` while preserving the existing buffer-based constructor.
* Build list validity, offsets, and the child array from nested Ruby values using the declared child type.
* Cover empty lists, null lists, and null child values.

### Are these changes tested?

Yes. The `red-arrow-format` suite passes locally (694 tests, 705 assertions).

### Are there any user-facing changes?

Yes. Callers can construct an `ArrowFormat::ListArray` directly from a list type and nested Ruby values.

### AI assistance

AI assistance drafted the implementation and tests. The final patch was reviewed against the existing typed constructors and low-level list array representation, and the focused and full package tests were run locally.

* GitHub Issue: #51262

Lead-authored-by: Yifan Chen <emecii23@gmail.com>
Co-authored-by: Yifan Chen <30335308+emecii@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-09-11 10:11:36 +09:00
Yifan Chen 9136394472 GH-50571: [Ruby] Add schema-aware ArrowFormat::RecordBatch construction (#51214)
### Rationale for this change

`ArrowFormat::RecordBatch.new(values)` infers a schema from Ruby values. This adds the corresponding schema-aware constructor so callers can preserve intended Arrow types while building from Ruby rows or columns.

### What changes are included in this PR?

* Add `ArrowFormat::RecordBatch.new(schema, values)` for row- and column-oriented Ruby values.
* Build each column through its schema field type and preserve null values.
* Cover type preservation, supported value forms, inconsistent column lengths, and invalid extra values.

### Are these changes tested?

Yes. The `red-arrow-format` suite passes locally (690 tests, 693 assertions), including the focused record-batch tests. The existing `red-arrow` record-batch suite also passes (21 tests, 21 assertions).

### Are there any user-facing changes?

Yes.

### AI assistance

AI assistance drafted the implementation and tests. The final scope was checked against the existing two-argument `Arrow::RecordBatch.new` contract and the one-argument `ArrowFormat::RecordBatch` API; the validation commands above were run locally.

* GitHub Issue: #50571

Authored-by: Yifan Chen <emecii23@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-09-09 03:25:45 +09:00
Hiroyuki Sato 68f3eb06a2 GH-51039: [CI][GLib][Ruby] Re-enable Arrow Flight tests for GLib and Ruby on macOS (#51040)
### Rationale for this change

It looks like [this change](https://github.com/ruby-gnome/ruby-gnome/pull/1743) has fixed issue #50919.
#50868 disabled Arrow Flight test for GLib on macOS.

### What changes are included in this PR?

Re-enable Arrow Flight tests for GLib and Ruby on macOS.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #51039

Authored-by: Hiroyuki Sato <hiroysato@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-08-31 06:35:30 +09:00
takuya kodama 5d286d47dc GH-50832: [Ruby] Add ArrowFormat::FixedSizeBinaryArray.new(byte_width, values) (#50854)
### Rationale for this change

Building a fixed size binary Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

Accept:

* `ArrowFormat::FixedSizeBinaryArray.new(byte_width, values)`
* `ArrowFormat::FixedSizeBinaryArray.new(type, values)`

`ArrowFormat::FixedSizeBinaryType.try_convert` is added for the byte width shorthand, in the same way as `ArrowFormat::Time32Array.new(unit, values)`. The existing 4 arguments form is kept.

Decimal arrays are out of scope. `ArrowFormat::DecimalArray#to_a` returns `BigDecimal`, so building one from Ruby objects needs a conversion between `BigDecimal` and two's complement. I would like to open a separate issue for it.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* GitHub Issue: #50832

Authored-by: otegami <a.s.takuya1026@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-08-24 17:47:20 +09:00
Sutou Kouhei 06c336af21 GH-50572: [Ruby] Add ArrowFormat::RecordBatch#records (#50590)
### Rationale for this change

It's a convenient API to get values as Ruby objects.

### What changes are included in this PR?

* Add `ArrowFormat::RecordBatch#records`
* Add `ArrowFormat::RecordBatch#each_record`
* Add `ArrowFormat::Record`
* Add `ArrowFormat::RecordBatch#find_column`
* Add `ArrowFormat::Schema#[]`
* Ensure using `String` for `ArrowFormat::Field#name`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50572

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-23 11:42:41 +09:00
Sutou Kouhei 154962c364 GH-50588: [Ruby] Add ArrowFormat::Array#[] (#50589)
### Rationale for this change

It's a convenient API to get a value at the given index.

### What changes are included in this PR?

Add `ArrowFormat::Array#[]`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50588

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-22 13:42:25 +09:00
Sutou Kouhei 0f54c056e6 GH-50569: [Ruby] Add ArrowFormat::RecordBatch.new(values) (#50570)
### Rationale for this change

It's convenient that we can build a record batch from Ruby objects.

### What changes are included in this PR?

* Add `ArrowFormat::RecordBatch.new({name1: column1, name2: column2, ...})` # column mode
* Add `ArrowFormat::RecordBatch.new([{name1: value1_1, name2: value2_1}, {name1: value1_2, name2: value2_2}, ...])` # row mode

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50569

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-21 15:48:18 +09:00
Sutou Kouhei 68c8cec16d GH-50528: [Ruby] Add ArrowFormat::ArrayBuilder (#50529)
### Rationale for this change

`ArrowFormat::Array.build(values)` is convenient to build an Arrow array from Ruby objects without specifying an Arrow type explicitly.

This is just for convenient. Users who want to specify Arrow type explicitly should use ArrowFormat::XXXArray.new(values) explicitly instead.

### What changes are included in this PR?

* Add `ArrowFromat::ArrayBuilder`
* Add `ArrowFormat::Array.build(values)`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50528

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-18 13:59:29 +09:00
Raúl Cumplido 179ff561d5 MINOR: [Release] Update versions for 26.0.0-SNAPSHOT 2026-07-10 10:49:40 +02:00
Aaditya Srinivasan 0e7c4ea348 GH-50456: [Ruby] Add ArrowFormat::DurationType#== (#50460)
### Rationale for this change

Comparing `ArrowFormat::DurationType` instances with the same unit should return `true`.

### What changes are included in this PR?

Add `ArrowFormat::DurationType#==`.

### Are these changes tested?

Yes.

Added tests for:

* equal duration types
* different duration types

### Are there any user-facing changes?

Yes.

GitHub Issue: #50456
* GitHub Issue: #50456

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 16:45:56 +09:00
Aaditya Srinivasan 7ca702cb34 GH-50439: Add ArrowFormat::{,Large}{Binary,UTF8}Array.new(values) (#50452)
### Rationale for this change

Building variable-size binary Arrow arrays from Ruby objects is convenient.

### What changes are included in this PR?

Accept:

* `ArrowFormat::BinaryArray.new(values)`
* `ArrowFormat::LargeBinaryArray.new(values)`
* `ArrowFormat::UTF8Array.new(values)`
* `ArrowFormat::LargeUTF8Array.new(values)`

### Are these changes tested?

Yes.

Added tests for:

* initialization
* mixed values with `nil`
* equality
* sliced arrays

### Are there any user-facing changes?

Yes.

* GitHub Issue: #50439

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 16:45:20 +09:00
Aaditya Srinivasan 783d7351d2 GH-50455: [Ruby] Add ArrowFormat::TimeType#== (#50461)
### Rationale for this change

Comparing `ArrowFormat::Time32Type` and `ArrowFormat::Time64Type` instances with the same unit should return `true`.

### What changes are included in this PR?

Add `ArrowFormat::TimeType#==`.

### Are these changes tested?

Yes.

Added tests for:

* `Time32Type`
  * equal types
  * different units
* `Time64Type`
  * equal types
  * different units

### Are there any user-facing changes?

Yes.

GitHub Issue: #50455
* GitHub Issue: #50455

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 16:44:09 +09:00
Aaditya Srinivasan 97b867856b GH-50438: Add ArrowFormat::DurationArray.new(unit, values) (#50447)
### Rationale for this change

Building a duration Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

Accept `ArrowFormat::DurationArray.new(unit, values)`.

### Are these changes tested?

Yes.

Added tests for:

* initialization
* mixed values with `nil`
* equality
* sliced arrays

### Are there any user-facing changes?

Yes.

* GitHub Issue: #50438

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 13:37:44 +09:00
Sutou Kouhei eea736989b GH-50437: [Ruby] Add ArrowFormat::*IntervalArray.new(values) (#50459)
### Rationale for this change

Building a year month/day time/month day nano interval Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

* Accept `ArrowFormat::YearMonthIntervalArray.new(values)`
* Accept `ArrowFormat::DayTimetntervalArray.new(values)`
* Add `ArrowFormat::DayTimeIntervalArray#each`
* Accept `ArrowFormat::MonthDayNanoIntervalArray.new(values)`
* Add `ArrowFormat::MonthDayNanoIntervalArray#each`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50437

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 13:35:38 +09:00
Sutou Kouhei 58a6ea28de GH-50436: [Ruby] Add ArrowFormat::TimestampArray.new(unit, values) (#50445)
### Rationale for this change

Building a timestamp Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

Accept `ArrowFormat::TimestampArray.new(unit, values)`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50436

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-10 06:31:29 +09:00
Sutou Kouhei 6166ef5980 GH-50435: [Ruby] Add ArrowFormat::Time{32,64}.new(unit, values) (#50443)
### Rationale for this change

Building a time{32,64} Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

Accept `ArrowFormat::Time{32,64}.new(unit, values)`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50435

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-09 18:18:21 +09:00
Sutou Kouhei 32513fe454 GH-50434: [Ruby] Add ArrowFormat::Date{32,64}.new(values) (#50442)
### Rationale for this change

Building a date{32,64} Arrow array from Ruby objects is convenient.

### What changes are included in this PR?

Accept `ArrowFormat::Date{32,64}.new(values)`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50434

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-09 16:38:10 +09:00
Sutou Kouhei e191b95db5 GH-50432: [Ruby] Add ArrowFormat::{Array,Bitmap}#== (#50433)
### Rationale for this change

Comparing 2 bitmaps/arrays is a common operation. We should provide content based (not identity based) comparition feature.

### What changes are included in this PR?

* Add `ArrowFormat::Bitmap#==`
* Add `ArrowFormat::Bitmap#offset`
* Add `ArrowFormat::Bitmap#size`
* Add `ArrowFormat::Bitmap#length`
* Make `ArrowFormat::Array` enumerable
* Add `ArrowFormat::Array#==`
* Add `ArrowFormat::NullArray#each`
* Add `ArrowFormat::PrimiveArray#each`
* Add `ArrowFormat::BooleanArray#each`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50432

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-09 15:15:10 +09:00
Raúl Cumplido d06b824cc5 GH-50412: [CI][GLib][Ruby] Remove some unnecessary Ubuntu 20.04 cases (#50413)
### Rationale for this change

We did drop support for Ubuntu 20.04 almost a year ago. We should remove cases that cater for it.

### What changes are included in this PR?

Found a couple places where we still seem to be doing some minor fixes for Ubuntu 20.04. Clean those up.

### Are these changes tested?

CI has been run

### Are there any user-facing changes?

No

* GitHub Issue: #50412

Authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-09 13:37:03 +09:00
Sutou Kouhei 463682df3b GH-50302: [GLib][Ruby][FlightRPC] Fix GC related problems (#50401)
### Rationale for this change

`gaflight_server_listen()` may use options' auth handler later. So we should refer the given options while the server is alive. If we don't refer the given options, we may touch freed auth handler later.

The argument of `ArrowFlight::Criteria.new`/`ArrowFlight::Ticket.new` should be referred to protect from GC in Ruby.

I could fix some problems by `GC.stress = true` but I couldn't fix some problems that are reproduced only on GitHub Actions. I omit tests for them for now.

### What changes are included in this PR?

* Refer options for `gaflight_server_listen()`
* Refer expression for `ArrowFlight::Criteria.new`
* Refer data for `ArrowFlight::Ticket.new`
* Omit Flight related tests that I can't fix...

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* GitHub Issue: #50302

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-09 09:38:55 +09:00
Sutou Kouhei dd69699564 GH-50390: [Ruby] Add int/float array builder for red-arrow-format (#50391)
### Rationale for this change

Int array and float array use similar structure. We can share common code for builder API for them.

### What changes are included in this PR?

Add `ArrowFormat::PrimitiveArray#build_data`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50390

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-07 09:22:24 +09:00
Sutou Kouhei 6570969847 GH-50385: [Ruby] Add bitmap builder for red-arrow-format (#50386)
### Rationale for this change

It can be used for validity bitmap and boolean array.

### What changes are included in this PR?

* Add `ArrowFormat::DenseBitmapBuilder`
* Add `ArrowFormat::SparseBitmapBuilder`
* Add `ArrowFormat::BooleanArray.new(values)`
* Use them in integration test

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #50385

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-07-06 21:33:21 +09:00
Aaditya SrinivasanandSutou Kouhei 12b3eda46a GH-45187: [Ruby] Ensure initializing all rb_memory_view_t members (#50234)
### Rationale for this change

`rb_memory_view_get()` callers may pass a non-zero-initialized `rb_memory_view_t`. `primitive_array_get()` and `buffer_get()` did not initialize `item_desc.components` and `item_desc.length`, which could cause `rb_memory_view_release()` to attempt to free an invalid pointer and abort the process.

### What changes are included in this PR?

This change initializes `item_desc.components` and `item_desc.length` in both `primitive_array_get()` and `buffer_get()`.

It also adds regression tests that verify releasing a memory view with a non-zero-initialized `rb_memory_view_t` does not crash for both `Arrow::Int32Array` and `Arrow::Buffer`.

### Are these changes tested?

Yes. Added regression tests in `test-memory-view.rb` that reproduced the crash before this change and pass after the fix.

### Are there any user-facing changes?

No.

**This PR contains a "Critical Fix".**

This change fixes a crash that could occur when `rb_memory_view_release()` is called with a memory view whose `item_desc` members were not initialized.
* GitHub Issue: #45187

Lead-authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-06-24 14:05:44 +09:00
1926639527 GH-38558: [C++] Add support for null sort option per sort key (#46926)
See #38584 for original PR. Will be quoted for this PR description.

### Rationale for this change

> support multi sortkey nulls first.

```
order by i nulls first, j, k nulls first;
```

> The current null sorting only supports all sortkeys, not a certain sortkey, so NullPlacement is extended to the SortKey field. Since the underlying framework is very well written, when modifying this function, you only need to pass the null_placement of each SortKey in. That’s it.

### What changes are included in this PR?

> 1.SortKey structure, NullPlacemnt transfer logic, sorting logic and Ording related, test related
> 2.Substriait related.
> 3.c_glib related.
> 4.SelectK related.
> 5.RankOptions related.

### Are these changes tested?

> yes, I changed the code inside vector_sort_test.cc and performed additional tests.

### Are there any user-facing changes?

> yes, pg database include null sorting of multiple sort keys.

**This PR includes breaking changes to public APIs.** (If there are any breaking changes to public APIs, please explain which changes are breaking. If not, you can remove this.)

I amended the original PR to be less breaking in public APIs.

Still Ordering, SortOptions, RankOptions, and RankQuantileOptions now accept a `std::optional<NullPlacement>` instead of NullPlacement, which did lead to some changes in downstream APIs and bindings. ~I also need some help with fixing the `c_glib` bindings.~
* GitHub Issue: #38558

Lead-authored-by: Alexander Taepper <alexander.taepper@gmail.com>
Co-authored-by: light-city <455954986@qq.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-06-22 13:22:16 +02:00
Aaditya Srinivasan 0249a2e4ca GH-50225: [Ruby] Move merge implementation to ColumnContainable (#50226)
### Rationale for this change

`Arrow::Table#merge` and `Arrow::RecordBatch#merge` had similar implementations, resulting in duplicated merge logic.

### What changes are included in this PR?

This PR moves the common merge implementation to `Arrow::ColumnContainable`.

Container-specific behavior such as column conversion and creating the merged container remains implemented in `Arrow::Table` and `Arrow::RecordBatch`.

### Are these changes tested?

Yes.

The existing `RecordBatch` and `Table` test suites were run and passed successfully.

### Are there any user-facing changes?

No.
* GitHub Issue: #50225

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-06-22 17:30:26 +09:00
Aaditya Srinivasan e6146ee654 GH-48294: [Ruby] Add RecordBatch#merge (#50175)
### Rationale for this change

This adds `Arrow::RecordBatch#merge` with behavior analogous to
`Arrow::Table#merge`.

### What changes are included in this PR?

- Add `RecordBatch#merge`
- Support merging with a `Hash`
- Support merging with another `RecordBatch`
- Support column addition, replacement, and removal (via `Hash` values of `nil`)
- Add tests covering the new behavior

### Are these changes tested?

Yes. Added unit tests covering:
- add column
- remove column
- replace column
- merge with another RecordBatch
- invalid merge target
* GitHub Issue: #48294

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-06-17 11:09:38 +09:00
Raúl Cumplido eb3c2f9cb4 MINOR: [Release] Update versions for 25.0.0-SNAPSHOT 2026-04-21 11:35:33 +02:00
Sutou Kouhei f51a70f654 GH-49656: [Ruby] Add benchmark for writers (#49657)
### Rationale for this change

Performance is important in Apache Arrow. So benchmark is useful for developing Apache Arrow implementation.

### What changes are included in this PR?

* Add benchmarks for file and streaming writers.
* Remove redundant type arguments from array constructors.

Here are benchmark results on my environment.

Pure Ruby implementation is about 2-2.5x slower than release build C++ implementation but about 2-2.5x faster than debug build C++ implementation.

Release build C++/GLib:

File format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/file-writer.yaml
ruby 4.1.0dev (2026-03-26T07:27:31Z master c5ab2114df) +PRISM [x86_64-linux]
Warming up --------------------------------------
           Arrow::Table#save    348.499 i/s -     374.000 times in 1.073175s (2.87ms/i)
Arrow::RecordBatchFileWriter    353.426 i/s -     385.000 times in 1.089337s (2.83ms/i)
     ArrowFormat::FileWriter    133.293 i/s -     140.000 times in 1.050314s (7.50ms/i)
Calculating -------------------------------------
           Arrow::Table#save    336.984 i/s -      1.045k times in 3.101035s (2.97ms/i)
Arrow::RecordBatchFileWriter    338.695 i/s -      1.060k times in 3.129655s (2.95ms/i)
     ArrowFormat::FileWriter    134.640 i/s -     399.000 times in 2.963462s (7.43ms/i)

Comparison:
Arrow::RecordBatchFileWriter:       338.7 i/s
           Arrow::Table#save:       337.0 i/s - 1.01x  slower
     ArrowFormat::FileWriter:       134.6 i/s - 2.52x  slower

```

Streaming format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/streaming-writer.yaml
ruby 4.1.0dev (2026-03-26T07:27:31Z master c5ab2114df) +PRISM [x86_64-linux]
Warming up --------------------------------------
             Arrow::Table#save    356.995 i/s -     385.000 times in 1.078447s (2.80ms/i)
Arrow::RecordBatchStreamWriter    347.891 i/s -     374.000 times in 1.075050s (2.87ms/i)
  ArrowFormat::StreamingWriter    156.709 i/s -     160.000 times in 1.021004s (6.38ms/i)
Calculating -------------------------------------
             Arrow::Table#save    350.743 i/s -      1.070k times in 3.050665s (2.85ms/i)
Arrow::RecordBatchStreamWriter    345.821 i/s -      1.043k times in 3.016011s (2.89ms/i)
  ArrowFormat::StreamingWriter    160.022 i/s -     470.000 times in 2.937090s (6.25ms/i)

Comparison:
             Arrow::Table#save:       350.7 i/s
Arrow::RecordBatchStreamWriter:       345.8 i/s - 1.01x  slower
  ArrowFormat::StreamingWriter:       160.0 i/s - 2.19x  slower
```

Debug build C++/GLib:

File format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/file-writer.yaml
ruby 4.1.0dev (2026-03-26T07:27:31Z master c5ab2114df) +PRISM [x86_64-linux]
Warming up --------------------------------------
           Arrow::Table#save     63.290 i/s -      66.000 times in 1.042815s (15.80ms/i)
Arrow::RecordBatchFileWriter     62.655 i/s -      66.000 times in 1.053389s (15.96ms/i)
     ArrowFormat::FileWriter    138.082 i/s -     140.000 times in 1.013891s (7.24ms/i)
Calculating -------------------------------------
           Arrow::Table#save     63.165 i/s -     189.000 times in 2.992143s (15.83ms/i)
Arrow::RecordBatchFileWriter     61.773 i/s -     187.000 times in 3.027220s (16.19ms/i)
     ArrowFormat::FileWriter    134.709 i/s -     414.000 times in 3.073285s (7.42ms/i)

Comparison:
     ArrowFormat::FileWriter:       134.7 i/s
           Arrow::Table#save:        63.2 i/s - 2.13x  slower
Arrow::RecordBatchFileWriter:        61.8 i/s - 2.18x  slower

```

Streaming format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/streaming-writer.yaml
ruby 4.1.0dev (2026-03-26T07:27:31Z master c5ab2114df) +PRISM [x86_64-linux]
Warming up --------------------------------------
             Arrow::Table#save     63.252 i/s -      66.000 times in 1.043439s (15.81ms/i)
Arrow::RecordBatchStreamWriter     61.272 i/s -      66.000 times in 1.077162s (16.32ms/i)
  ArrowFormat::StreamingWriter    152.598 i/s -     160.000 times in 1.048506s (6.55ms/i)
Calculating -------------------------------------
             Arrow::Table#save     61.016 i/s -     189.000 times in 3.097525s (16.39ms/i)
Arrow::RecordBatchStreamWriter     63.024 i/s -     183.000 times in 2.903642s (15.87ms/i)
  ArrowFormat::StreamingWriter    160.416 i/s -     457.000 times in 2.848846s (6.23ms/i)

Comparison:
  ArrowFormat::StreamingWriter:       160.4 i/s
Arrow::RecordBatchStreamWriter:        63.0 i/s - 2.55x  slower
             Arrow::Table#save:        61.0 i/s - 2.63x  slower

```

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49656

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-04-05 16:55:23 +09:00
Sutou Kouhei 3c25e693cb GH-49634: [Ruby][Integration] Follow dictionary array API change (#49635)
### Rationale for this change

GH-49621 changed dictionary array related API but we didn't follow the API change in integration test code.

### What changes are included in this PR?

Follow dictionary array related API change in integration test code.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #49634

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-04-01 19:27:18 +09:00
Sutou Kouhei 92734673d1 GH-49620: [Ruby] Add support for custom metadata in Message (#49621)
### Rationale for this change

`Message` can attach custom metadata: https://github.com/apache/arrow/blob/61ef6722b01a289ca6e09d3c5aaef782f060f94c/format/Message.fbs#L152-L157

### What changes are included in this PR?

* Add `ArrowFormat::Dictionary` for dictionary
* Add support for reading custom metadata in `Message` and attaching them to `ArrowFormat::Schema`, `ArrowFormat::RecordBatch` and `ArrowFormat::Dictionary`
* Add support for writing custom metadata in `ArrowFormat::Schema`, `ArrowFormat::RecordBatch` and `ArrowFormat::Dictionary` as `Message`'s custom metadata

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49620

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-04-01 12:01:36 +09:00
Sutou Kouhei c24bc29100 GH-49576: [Ruby] Add support for custom metadata in Footer (#49577)
### Rationale for this change

In file format, Footer can have custom metadata.

### What changes are included in this PR?

* Add `garrow_record_batch_file_reader_get_metadata()`
* Add `garrow_record_batch_file_writer_new_full()`
* Add `ArrowFormat::FileReader#metadata`
* Add `metadata` to `ArrowFormat::FileWriter#finish`
* Add `metadata:` to `Arrow::Table#save`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* GitHub Issue: #49576

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-03-23 06:32:49 +09:00
Sutou Kouhei 10eaafd2b4 GH-49544: [Ruby] Add benchmark for readers (#49545)
### Rationale for this change

Performance is important in Apache Arrow. So benchmark is useful for developing Apache Arrow implementation.

### What changes are included in this PR?

* Add benchmarks for file and streaming readers.
* Add support for `mmap` in streaming reader. 

Here are benchmark results on my environment.

Pure Ruby implementation is about 5-6x slower than release build C++ implementation but a bit faster than debug build C++ implementation.

Release build C++/GLib:

File format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/file-reader.yaml
ruby 4.1.0dev (2026-02-19T09:04:23Z master 6bb0b6b16c) +PRISM [x86_64-linux]
Warming up --------------------------------------
           Arrow::Table.load    11.207k i/s -     12.188k times in 1.087487s (89.23μs/i)
Arrow::RecordBatchFileReader    19.724k i/s -     21.296k times in 1.079727s (50.70μs/i)
     ArrowFormat::FileReader     3.555k i/s -      3.883k times in 1.092223s (281.28μs/i)
Calculating -------------------------------------
           Arrow::Table.load    11.483k i/s -     33.622k times in 2.928024s (87.09μs/i)
Arrow::RecordBatchFileReader    19.673k i/s -     59.170k times in 3.007729s (50.83μs/i)
     ArrowFormat::FileReader     3.574k i/s -     10.665k times in 2.984214s (279.81μs/i)

Comparison:
Arrow::RecordBatchFileReader:     19672.6 i/s
           Arrow::Table.load:     11482.8 i/s - 1.71x  slower
     ArrowFormat::FileReader:      3573.8 i/s - 5.50x  slower

```

Streaming format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/streaming-reader.yaml
ruby 4.1.0dev (2026-02-19T09:04:23Z master 6bb0b6b16c) +PRISM [x86_64-linux]
Warming up --------------------------------------
             Arrow::Table.load    11.360k i/s -     12.485k times in 1.099067s (88.03μs/i)
Arrow::RecordBatchStreamReader    20.180k i/s -     21.857k times in 1.083126s (49.56μs/i)
  ArrowFormat::StreamingReader     3.398k i/s -      3.400k times in 1.000479s (294.26μs/i)
Calculating -------------------------------------
             Arrow::Table.load    11.397k i/s -     34.078k times in 2.990170s (87.74μs/i)
Arrow::RecordBatchStreamReader    20.039k i/s -     60.538k times in 3.020964s (49.90μs/i)
  ArrowFormat::StreamingReader     3.340k i/s -     10.195k times in 3.052059s (299.37μs/i)

Comparison:
Arrow::RecordBatchStreamReader:     20039.3 i/s
             Arrow::Table.load:     11396.7 i/s - 1.76x  slower
  ArrowFormat::StreamingReader:      3340.4 i/s - 6.00x  slower

```

Debug build C++/GLib:

File format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/file-reader.yaml
ruby 4.1.0dev (2026-02-19T09:04:23Z master 6bb0b6b16c) +PRISM [x86_64-linux]
Warming up --------------------------------------
           Arrow::Table.load     2.175k i/s -      2.200k times in 1.011375s (459.72μs/i)
Arrow::RecordBatchFileReader     3.129k i/s -      3.421k times in 1.093397s (319.61μs/i)
     ArrowFormat::FileReader     3.384k i/s -      3.430k times in 1.013625s (295.52μs/i)
Calculating -------------------------------------
           Arrow::Table.load     2.145k i/s -      6.525k times in 3.041760s (466.17μs/i)
Arrow::RecordBatchFileReader     3.020k i/s -      9.386k times in 3.108456s (331.18μs/i)
     ArrowFormat::FileReader     3.368k i/s -     10.151k times in 3.013576s (296.87μs/i)

Comparison:
     ArrowFormat::FileReader:      3368.4 i/s
Arrow::RecordBatchFileReader:      3019.5 i/s - 1.12x  slower
           Arrow::Table.load:      2145.1 i/s - 1.57x  slower

```

Streaming format:

```console
$ ruby -v -S benchmark-driver ruby/red-arrow-format/benchmark/streaming-reader.yaml
ruby 4.1.0dev (2026-02-19T09:04:23Z master 6bb0b6b16c) +PRISM [x86_64-linux]
Warming up --------------------------------------
             Arrow::Table.load     2.115k i/s -      2.140k times in 1.011815s (472.81μs/i)
Arrow::RecordBatchStreamReader     3.052k i/s -      3.355k times in 1.099273s (327.65μs/i)
  ArrowFormat::StreamingReader     3.283k i/s -      3.290k times in 1.002016s (304.56μs/i)
Calculating -------------------------------------
             Arrow::Table.load     2.198k i/s -      6.345k times in 2.886603s (454.94μs/i)
Arrow::RecordBatchStreamReader     3.105k i/s -      9.156k times in 2.948523s (322.03μs/i)
  ArrowFormat::StreamingReader     3.225k i/s -      9.850k times in 3.054339s (310.09μs/i)

Comparison:
  ArrowFormat::StreamingReader:      3224.9 i/s
Arrow::RecordBatchStreamReader:      3105.3 i/s - 1.04x  slower
             Arrow::Table.load:      2198.1 i/s - 1.47x  slower

```

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #49544

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-03-21 17:59:16 +09:00
Sutou Kouhei ed37b14f40 GH-49422: [CI][Integration][Ruby] Add the Ruby implementation (#49423)
### Rationale for this change

There are some missing features in the Ruby implmentaion for now but we can pass them by skipping some tests in our integration tests.

### What changes are included in this PR?

Archery:

* Add `--with-ruby` to `archery integration`
* Add `archery.integration.tester_ruby.RubyTester`
* Add `no_map_field_names_validate` quirk for GH-49415
* Show environment variables too on external command failure because Ruby tester uses environment variables not command line arguments to pass information to integration tester
* Use `ARCHERY_INTEGRATION_WITH_CPP=1` instead of `ARROW_INTEGRATION_CPP=ON` like other implementations such as `ARCHERY_INTEGRATION_WITH_GO`

Ruby:

* Add `red-arrow-format-integration-test` as the test driver
  * This is not included in `.gem` because this is only for development
* Add `ruby/red-arrow-format/lib/arrow-format/integration/` as helpers of the test driver
  * This is not included in `.gem` because this is only for development
* Add `ArrowFormat::Array#empty?`
* Add `ArrowFormat::RecordBatch#empty?`
* Add `ArrowFormat::NullArray#n_nulls`
* `ArrowFormat::*Array#to_a`: Add support for empty case
* Fix Apache Arrow decimal <-> `BigDecimal` conversion
* `ArrowFormat::Bitmap#each`: Fix a bug that one bit is ignored
* Move dictionary ID to `ArrowFormat::DictionaryType` from `ArrowFormat::Field`
* Add support for V4 union that has validity bitmap
* Add support for no continuation token message for backward compatibility
* `ArrowFormat::StreamingReader`: Add support for reading schema without calling `#each`
* `ArrowFormat::MapType`: Add support for keys sorted
* `ArrowFormat::MapType`: Always use "key"/"value"/"entries" for field names

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49422

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-03-10 13:14:11 +09:00
Sutou Kouhei 1cac811744 GH-49406: [Ruby] Add support for fixed size list array (#49407)
### Rationale for this change

It's a fixed size variant of list array.

### What changes are included in this PR?

* Add `ArrowFormat::FixedSizeListType`
* Add `ArrowFormat::FixedSizeListArray`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49406

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-03-01 15:08:45 +09:00
Sutou Kouhei 879bbb3677 GH-49400: [Ruby] Add Arrow::FixedSizeList#values and #raw_records (#49401)
### Rationale for this change

They are optimized C++ values -> Ruby values converters.

### What changes are included in this PR?

* Add support for `arrow::FixedSizeListArray` in `#values` and `#raw_records` implementation in C++
* Add tests for `Arrow::FixedSizeList#values` and `#raw_values`
* Add tests for `Arrow::LargeList#values` and `#raw_values` because they are missing
  * This is not so related to `Arrow::FixedSizeList#values` and `#raw_values`. Sorry.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49400

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-27 16:07:35 +09:00
Sutou Kouhei dc5b76e111 GH-49389: [Ruby] Add support for custom metadata in field and schema (#49390)
### Rationale for this change

We can add custom metadata to `Field` and `Schema`.

### What changes are included in this PR?

* Add `ArrowFormat::Field#metadata`
* Add `ArrowFormat::Schema#metadata`
* Add support for reading and writing custom metadata in `Field` and `Schema`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49389

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-26 09:59:58 +09:00
Sutou Kouhei 84a57018b6 GH-49364: [Ruby] Simplify reader tests (#49365)
### Rationale for this change

The current reader tests use a sub test case per type but we can use a test per type like the current writer tests.

### What changes are included in this PR?

* Create test data in a test not a setup to use a test no a sub test case per type
* Add `ArrowFormat::Type#to_s`
* Add `ArrowFormat::FileReader#schema`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #49364

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-22 23:25:46 +09:00
Sutou Kouhei 031a2a4d87 GH-49316: [Ruby] Add support for auto dependency install for red-arrow on macOS (#49317)
### Rationale for this change

If `gem install red-arrow` installs Apache Arrow GLib automatically, it's convenient for users.

### What changes are included in this PR?

Add a rubygems-requirements-system configuration for Homebrew.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49316

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-19 09:41:07 +09:00
Sutou Kouhei 6c86961fd1 GH-49318: [Ruby] Ensure using extpp 0.1.2 or later (#49319)
### Rationale for this change

extpp 0.1.2 includes C++20 support.

### What changes are included in this PR?

Update required version information of extpp dependency.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #49318

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-02-18 08:50:08 +01:00
Sutou Kouhei a272046852 GH-49225: [Ruby] Add support for writing dictionary delta for primitive dictionary (#49226)
### Rationale for this change

Nested types and dictionary type are out of scope of this.

### What changes are included in this PR?

* Fix `ArrowFormat::Array#slice_offsets_buffer`
* Add `ArrowFormat::DayTimeIntervalArray#element_size`
* `ArrowFormat::Bitmap#each`: Add support for offset
* Add support for chunked dictionaries
* Add support for `Arrow::DictionaryArray#raw_records` with large binary and large UTF-8 dictionaries

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49225

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-13 06:44:29 +09:00
Sutou Kouhei bc48921816 GH-49208: [Ruby] Add support for writing dictionary delta message (#49209)
### Rationale for this change

This focuses on implementing base dictionary delta message support mechanism. So this adds support for only UTF-8 array as dictionary. Other arrays will be supported in follow-up tasks.

### What changes are included in this PR?

* Add support for `ArrowFromat#slice` (But it's not completed. It just works partially.)
* If the second record batch includes an updated dictionary (new entries are appended), these appended entries are sliced and they are only written as delta.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49208

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-11 09:07:38 +09:00
Sutou Kouhei 252a6850bd GH-48132: [Ruby] Add support for writing dictionary array (#49175)
### Rationale for this change

Delta dictionary message support is out of scope.

### What changes are included in this PR?

* Add `ArrowFormat::DictionaryArray#each_buffer`
* Add `ArrowFormat::DictionaryType#build_fb_type`
* Add support for dictionary message in `ArrowFormat::StreamingWriter`
* Add support for writing dictionary message blocks in footer in `ArrowFormat::FileWriter`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #48132

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-08 16:42:03 +09:00
Sutou Kouhei db349f16f7 GH-49119: [Ruby] Add support for writing map array (#49120)
### Rationale for this change

It's a list based array.

### What changes are included in this PR?

* Add `ArrowFormat::MapType#to_flatbuffers`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49119

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-03 20:21:10 +09:00
Sutou Kouhei 262e4e19b2 GH-49117: [Ruby] Add support for writing union arrays (#49118)
### Rationale for this change

There are dense and sparse variants.

### What changes are included in this PR?

* Add `garrow_union_array_get_n_fields()`
* Add `ArrowFormat::UnionArray#children`
* Add `ArrowFormat::DenseUnionArray#each_buffer`
* Add `ArrowFormat::SparseUnionArray#each_buffer`
* Add `ArrowFormat::UnionType#to_flatbuffers`
* Add `Arrow::UnionArray#fields`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49117

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-03 20:20:40 +09:00
Sutou Kouhei 93c4e002c6 GH-49093: [Ruby] Add support for writing duration array (#49094)
### Rationale for this change

It has unit parameter.

### What changes are included in this PR?

* Add `ArrowFormat::DurationType#to_flatbuffers`
* Add duration support to `#values` and `raw_records`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49093

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-02 20:36:17 +09:00
Sutou Kouhei dbca9584c0 GH-49096: [Ruby] Add support for writing struct array (#49097)
### Rationale for this change

It's a nested array.

### What changes are included in this PR?

* Add `ArrowFormat::StructType#to_flatbuffers`
* Add `ArrowFormat::StructArray#each_buffer`
* Add `ArrowFormat::StructArray#children`
* Fix `ArrowFormat::Array#n_nulls`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #49096

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-02-02 20:35:00 +09:00