You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/25 14:14:05 UTC

[GitHub] [arrow] milesgranger commented on a diff in pull request #14495: ARROW-17989: [C++][Python] Enable struct_field kernel to accept string field names

milesgranger commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1004546915


##########
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:
   Which would be equivalent to a dot path of `.b.c`, is that right?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org