-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Odd behavior of type tracing on IndexOptionalArray
#3264
Comments
Here's a reproducer that doesn't use dask-awkward (thus demonstrating that the bug is in Awkward): >>> arr = ak.Array([[1], [2, 3], [1, 2, 4, 5]])[[0, None, 2]]
>>> ak.typetracer.length_one_if_typetracer(ak.to_backend(arr, "typetracer"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jpivarski/irishep/awkward/src/awkward/typetracer.py", line 133, in length_one_if_typetracer
return _length_0_1_if_typetracer(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jpivarski/irishep/awkward/src/awkward/typetracer.py", line 81, in _length_0_1_if_typetracer
layout = function(layout.form, highlevel=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jpivarski/irishep/awkward/src/awkward/forms/form.py", line 638, in length_one_array
return ak.operations.ak_from_buffers._impl(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jpivarski/irishep/awkward/src/awkward/operations/ak_from_buffers.py", line 154, in _impl
out = _reconstitute(form, length, container, getkey, backend, byteorder, simplify)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jpivarski/irishep/awkward/src/awkward/operations/ak_from_buffers.py", line 296, in _reconstitute
content = _reconstitute(
^^^^^^^^^^^^^^
File "/home/jpivarski/irishep/awkward/src/awkward/operations/ak_from_buffers.py", line 342, in _reconstitute
raw_array1 = container[getkey(form, "starts")]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'None' This >>> form, length, container = ak.to_buffers(arr)
>>> print(form)
{
"class": "IndexedOptionArray",
"index": "i64",
"content": {
"class": "ListArray",
"starts": "i64",
"stops": "i64",
"content": {
"class": "NumpyArray",
"primitive": "int64",
"form_key": "node2"
},
"form_key": "node1"
},
"form_key": "node0"
}
>>> length
3
>>> for key, value in container.items():
... print(f"{repr(key):<20s}: {str(value)}")
...
'node0-index' : [ 0 -1 1]
'node1-starts' : [0 3]
'node1-stops' : [1 7]
'node2-data' : [1 2 3 1 2 4 5] As a typetracer, the values in the {
"class": "IndexedOptionArray",
"index": "i64",
"content": {
"class": "ListArray",
"starts": "i64",
"stops": "i64",
"content": "int64"
},
"form_key": "node-0"
}
length = 1
'node-0' : b'\xff\xff\xff\xff\xff\xff\xff\xff' The IndexedOptionArray has a |
Version of Awkward Array
2.6.8
Description and code to reproduce
When attempting to run type tracing on an
IndexOptionalArray
, this generates an error. This is most noticable when using with dask awkward.With the last line generating the error:
The same behavior can be triggered with just awkward with the following:
I'm not sure if this should be classified as an
awkward
issue, or an issue with howdask_awkward
is generating its_meta
array used for type tracing. I can forward this todask_awkward
if it looks to be more appropriate to discuss over there.The text was updated successfully, but these errors were encountered: