You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Add support for unsigned Arrow datatypes in schema conversion (#1617)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes#123` indicates that this PR will close issue #123.
-->
- Closes#675
## What changes are included in this PR?
<!--
Provide a summary of the modifications in this PR. List the main changes
such as new features, bug fixes, refactoring, or any other updates.
-->
### Bug Fixes
- Fixed crash when ArrowSchemaConverter encounters unsigned datatypes
- Resolved "Unsupported Arrow data type" errors for UInt8/16/32/64
### Features
- Added casting support for unsigned Arrow types
- UInt8/16 → Int32 (safe casting to larger signed type)
- UInt32 → Int64 (safe casting to larger signed type)
- UInt64 → Error (no safe casting option, explicit error with guidance)
### Code Changes
- Enhanced ArrowSchemaConverter primitive() method with unsigned type
handling
- Added comprehensive test: test_unsigned_type_casting() for all
unsigned variants
### Files Modified
- `crates/iceberg/src/arrow/schema.rs`
## Impact
✅ No breaking changes - existing functionality preserved
✅ Safe type casting prevents overflow issues
✅ Clear error messages for unsupported UInt64 with alternatives
✅ Follows proven PyIceberg implementation approach
## Are these changes tested?
- All existing schema tests pass
- New comprehensive test covers UInt8, UInt16, UInt32, UInt64 conversion
behavior
- Test verifies proper casting: UInt8/16→Int32, UInt32→Int64,
UInt64→Error
<!--
Specify what test covers (unit test, integration test, etc.).
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
0 commit comments