awkward icon indicating copy to clipboard operation
awkward copied to clipboard

`ak.fill_none` fails with typetracer Array

Open douglasdavis opened this issue 3 years ago • 0 comments

Version of Awkward Array

1.10.0rc4

Description and code to reproduce

>>> import awkward._v2 as ak
>>> x = ak.Array([1, 2, None])
>>> ak.fill_none(x, 0)
<Array [1, 2, 0] type='3 * int64'>
>>> tt = ak.Array(x.layout.typetracer.forget_length())
>>> tt
<Array-typetracer type='?? * ?int64'>
>>> ak.fill_none(tt, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ddavis/software/repos/awkward/awkward/_v2/operations/ak_fill_none.py", line 59, in fill_none
    return _impl(array, value, axis, highlevel, behavior)
  File "/Users/ddavis/software/repos/awkward/awkward/_v2/operations/ak_fill_none.py", line 82, in _impl
    nplike.asarray(value), allow_record=False, allow_other=False
  File "/Users/ddavis/software/repos/awkward/awkward/_v2/_typetracer.py", line 524, in asarray
    dtype = array.dtype
AttributeError: 'int' object has no attribute 'dtype'

Looks like fill_none tries to call asarray on the value argument (in the code block I'm using 0 as the value), TypeTracer.asarray(arg) assumes that arg has a dtype attribute.

douglasdavis avatar Sep 16 '22 17:09 douglasdavis