apache / apache/arrow

[Python] OverflowError when inferring large unsigned integers (uint64 not handled)

Open
#47,607 0 comments 0 reactions 1 assignee Claimed by @sanjay20m View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

When converting Python integers to Arrow types, the current type inference
always defaults to int64. This causes an OverflowError when handling integers
greater than 2**63 - 1.

Example:
data = [0, np.iinfo(np.uint64).max]
pa.array(data) # raises OverflowError

Expected:
Inference should detect values that fit into uint64 and select that type
instead of failing.

A proposed fix tracks min/max integer values during inference and chooses the
smallest fitting signed/unsigned integer type.

pr link: https://github.com/apache/arrow/pull/47604

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.