-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: extend TypeTracerArray with __eq__, __ne__, and __array_ufunc__. (…
…#2021) * fix: extend TypeTracerArray with __eq__, __ne__, and __array_ufunc__. * Added a test to ensure that this fix survives a refactoring. * Fixes the 'invalid value encountered in cast' error. * This should fix the precision error.
- Loading branch information
Showing
4 changed files
with
107 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE | ||
|
||
import awkward as ak | ||
|
||
|
||
def test(): | ||
conditionals = ak.Array([True, True, True, False, False, False]) | ||
unionarray = ak.Array([1, 2, 3, [4, 5], [], [6]]) | ||
otherarray = ak.Array(range(100, 106)) | ||
result = ak.where(conditionals, unionarray, otherarray) | ||
assert result.tolist() == [1, 2, 3, 103, 104, 105] | ||
assert str(result.type) == "6 * union[int64, var * int64]" | ||
|
||
conditionals_tt = ak.Array(conditionals.layout.to_typetracer()) | ||
unionarray_tt = ak.Array(unionarray.layout.to_typetracer()) | ||
otherarray_tt = ak.Array(otherarray.layout.to_typetracer()) | ||
result_tt = ak.where(conditionals_tt, unionarray_tt, otherarray_tt) | ||
assert str(result_tt.type) == "6 * union[int64, var * int64]" |