Skip to content

Commit

Permalink
vaex-core: arrow: fix overflow error -- test_groupy_int8_with_null
Browse files Browse the repository at this point in the history
sub: 255 - array([127],int8)
  • Loading branch information
2maz committed Jan 18, 2025
1 parent d235bea commit 362ce2a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/vaex-core/vaex/arrow/numpy_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,19 @@ def closure(op=op):
def operator(b, a):
a_data = a
b_data = b
if isinstance(a, NumpyDispatch):
a_data = a.numpy_array
if isinstance(b, NumpyDispatch):
b_data = b.numpy_array
if isinstance(a_data, NumpyDispatch):
a_data = a_data.numpy_array
if isinstance(b_data, NumpyDispatch):
b_data = b_data.numpy_array

result_type = np.result_type(np.min_scalar_type(a_data), np.min_scalar_type(b_data))
if isinstance(a_data, np.ndarray):
a_data = a_data.astype(result_type)
if isinstance(b_data, np.ndarray):
b_data = b_data.astype(result_type)

result_data = op['op'](a_data, b_data)

if isinstance(a, NumpyDispatch):
result_data = a.add_missing(result_data)
if isinstance(b, NumpyDispatch):
Expand Down

0 comments on commit 362ce2a

Please sign in to comment.