jorisvandenbossche commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1004549244
##########
python/pyarrow/tests/test_compute.py:
##########
@@ -2691,16 +2691,28 @@ def test_struct_fields_options():
b = pa.array(["bar", None, ""])
c = pa.StructArray.from_arrays([a, b], ["a", "b"])
arr = pa.StructArray.from_arrays([a, c], ["a", "c"])
-
- assert pc.struct_field(arr,
- indices=[1, 1]) == pa.array(["bar", None, ""])
- assert pc.struct_field(arr, [1, 1]) == pa.array(["bar", None, ""])
- assert pc.struct_field(arr, [0]) == pa.array([4, 5, 6], type=pa.int64())
+ assert pc.struct_field(arr, '.c.b', is_dot_path=True) == b
+ assert pc.struct_field(arr, '.a', is_dot_path=True) == a
+ assert pc.struct_field(arr, 'a') == a
+ assert pc.struct_field(arr, indices=[1, 1]) == b
+ assert pc.struct_field(arr, [1, 1]) == b
Review Comment:
Yes, and we should probably allow passing an actual FieldRef instance as
well (`pc.field(("b", "c"))`)
Personally, I am not sure we necessarily need to support a dotted path here,
especially if it requires a keyword (which seems to defeat the purpose of added
convenience a bit?)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]