arrow
arrow copied to clipboard
[Ruby] Type inference bug: list element type stays int8 for large integers in nested arrays
Describe the bug, including details regarding any error messages, version, and platform.
When creating an Arrow::Table from a Ruby Hash where a column contains nested arrays of Integer values, the element type of the list is inferred as int8 even when the values are outside the int8 range.
In the reproduction below, the input includes values ±65536, but the schema still becomes list<item: int8>.
Related: #48478 (nested non-negative integers inferred as string)
Steps to reproduce the bug
require "arrow"
p Arrow::Table.new(val: [[2**16, -1], [-2**16]]).schema
# Actual:
# #<Arrow::Schema:... val: list<item: int8>>
Expected behavior
The list element type should be widened based on the values.
For this reproduction, I would expect at least list<item: int32> (since ±65536 does not fit in int16).
Actual behavior
The schema is inferred as val: list<item: int8>.
Environment
- OS: macOS 26.1
- CPU arch: Apple M4 Pro
- Ruby: 3.4.7
- Gems: red-arrow 22.0.0
- Arrow installation method: Homebrew
Component(s)
Ruby