-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug: ak.isfinite fails on non-float dtypes (int/uint/bool)
Summary
ak.isfinite raises a runtime error when called on integer, unsigned integer, or boolean arrays. This diverges from NumPy semantics, where isfinite is defined for all numeric dtypes and always returns True for non-floating inputs.
Expected Behavior (NumPy)
np.isfinite(np.array([1, 2, 3], dtype=int)) # array([True, True, True])
np.isfinite(np.array([1, 2, 3], dtype=uint64)) # array([True, True, True])
np.isfinite(np.array([True, False])) # array([True, True])Actual Behavior (Arkouda)
ak.isfinite(ak.array([1, 2, 3]))Raises:
RuntimeError: Error executing command isfinite<1>: cannot cast class to type - runtime types not compatible
This occurs for:
- int64
- uint64
- bool
Root Cause
The Arkouda backend dispatches isfinite<1> for non-float inputs, but the server kernel expects floating-point types and fails during runtime casting.
Impact
- NumPy alignment tests fail
- Users cannot safely call
ak.isfiniteon non-float arrays - Inconsistent behavior relative to NumPy and pandas expectations
Proposed Fix
Short-circuit ak.isfinite for non-floating dtypes in the Python wrapper:
- If dtype is integer, unsigned, or boolean:
- Return
ak.full(x.size, True, ak.bool)
- Return
- Only dispatch the server-side
isfinitekernel for floating-point inputs
This exactly matches NumPy semantics and avoids unnecessary server calls.
Temporary Workaround (Tests)
Mark isfinite for non-float kinds as xfail in NumPy-alignment tests until the backend behavior is fixed.
Related Test Failure
test_unary_alignment[False-isfinite-isfinite-isfinite-kinds]
RuntimeError: cannot cast class to type
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working