milesgranger commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1004555251
##########
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:
Could do the same assumption `FromDotPath` does and create one if it has a
leading `.`, then remove the kwarg? And add a `auto_dot_path=True` along with
it, such that if someone literally has a field with a leading dot they could
switch that off?
--
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]