pitrou commented on code in PR #12863:
URL: https://github.com/apache/arrow/pull/12863#discussion_r848416435
##########
cpp/src/arrow/compute/exec/expression_test.cc:
##########
@@ -1376,12 +1376,18 @@ TEST(Expression, SerializationRoundTrips) {
ExpectRoundTrips(field_ref("field"));
+ ExpectRoundTrips(field_ref(FieldRef("foo", "bar", "baz")));
Review Comment:
Do we have to spell out `field_ref(FieldRef("foo", "bar"))` explicitly or is
it possible to simply write `field_ref("foo", "bar")`?
##########
python/pyarrow/compute.py:
##########
@@ -597,16 +597,29 @@ def field(name_or_index):
Stores only the field's name. Type and other information is known only when
the expression is bound to a dataset having an explicit scheme.
+ Nested references are allowed by passing a tuple of names.
+ For example ``('foo', 'bar')`` references the field named "bar" inside
+ the field named "foo".
+
Parameters
----------
- name_or_index : string or int
- The name or index of the field the expression references to.
+ name_or_index : string, tuple or int
+ The name or index of the (possibly nested) field the expression
+ references to.
Returns
-------
field_expr : Expression
"""
- return Expression._field(name_or_index)
+ if isinstance(name_or_index, str) or isinstance(name_or_index, int):
Review Comment:
Nit :-)
```suggestion
if isinstance(name_or_index, (str, int)):
```
--
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]