-
Notifications
You must be signed in to change notification settings - Fork 97
Closed
Labels
bugThe problem described is something that must be fixedThe problem described is something that must be fixed
Description
Version of Awkward Array
main branch
Description and code to reproduce
If there is an EmptyForm somewhere in the form, then from_buffers doesn't work with virtual arrays.
Here is a simple reproducer.
import awkward as ak
import numpy as np
form = ak.forms.UnionForm(
"i8",
"i64",
[
ak.forms.IndexedOptionForm('i64', ak.forms.EmptyForm(), form_key="nones"),
ak.forms.UnmaskedForm(ak.forms.NumpyForm("int64", form_key="ints")),
ak.forms.UnmaskedForm(ak.forms.ListOffsetForm(
"i64",
ak.forms.NumpyForm("float64", form_key="floats"),
form_key="offsets")),
],
form_key="union"
)
virtual_buffers = {
"nones-index": lambda: np.array([-1], dtype=np.int64),
"ints-data": lambda: np.array([0, 1], dtype=np.int64),
"floats-data": lambda: np.array([1., 2.], dtype=np.float64),
"offsets-offsets": lambda: np.array([0,2], dtype=np.int64),
"union-tags": lambda: np.array([1, 2], dtype=np.int8),
"union-index": lambda: np.array([0, 0], dtype=np.int64),
}
eager_buffers = {k: v() for k,v in virtual_buffers.items()}
# This works
array = ak.from_buffers(form, 2, eager_buffers)
print(array)
# This doesn't
array = ak.from_buffers(form, 2, virtual_buffers)
print(array)Metadata
Metadata
Assignees
Labels
bugThe problem described is something that must be fixedThe problem described is something that must be fixed