AlenkaF commented on code in PR #12863:
URL: https://github.com/apache/arrow/pull/12863#discussion_r849060220
##########
python/pyarrow/_compute.pyx:
##########
@@ -2219,10 +2219,26 @@ cdef class Expression(_Weakrefable):
@staticmethod
def _field(name_or_idx not None):
- if isinstance(name_or_idx, str):
- return Expression.wrap(CMakeFieldExpression(tobytes(name_or_idx)))
- else:
+ cdef:
+ CFieldRef c_field
+
+ if isinstance(name_or_idx, int):
return Expression.wrap(CMakeFieldExpressionByIndex(name_or_idx))
+ else:
+ c_field = CFieldRef(<c_string> tobytes(name_or_idx))
+ return Expression.wrap(CMakeFieldExpression(c_field))
+
+ @staticmethod
+ def _nested_field(tuple names not None):
+ cdef:
+ vector[CFieldRef] nested
+
+ if len(names) == 0:
+ raise ValueError("nested field reference should be non-empty")
+ nested.reserve(len(names))
+ for name in names:
+ nested.push_back(CFieldRef(<c_string> tobytes(name)))
Review Comment:
https://issues.apache.org/jira/browse/ARROW-16180
--
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]