I'm trying to use the compute function struct_field in order to create an
expression for dataset filtering. But running into an error. This is the
code snippet:
arr1 = pa.array([100, 200, 300])
arr2 = pa.array([400, 500, 600])
arr3 = pa.StructArray.from_arrays([arr1, arr2], ["one", "two"])
e = pc.call_function("struct_field", arr3,
pc.StructFieldOptions(indices=[0])) > 200
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyarrow/_compute.pyx", line 531, in pyarrow._compute.call_function
File "pyarrow/_compute.pyx", line 330, in pyarrow._compute.Function.call
File "pyarrow/error.pxi", line 143, in
pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 99, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Function 'struct_field' accepts 1 arguments but
attempted to look up kernel(s) with 3
If I try to exclude the options, I get
pyarrow.lib.ArrowInvalid: Function 'struct_field' cannot be called without
options
Any advice? I am using pyarrow 7.0.0
--
Partha Dutta
[email protected]