kszucs commented on a change in pull request #7732:
URL: https://github.com/apache/arrow/pull/7732#discussion_r763187191
##########
File path: python/pyarrow/gandiva.pyx
##########
@@ -440,26 +446,70 @@ cdef class TreeExprBuilder(_Weakrefable):
condition.node)
return Condition.create(r)
+
cpdef make_projector(Schema schema, children, MemoryPool pool,
str selection_mode="NONE"):
- cdef c_vector[shared_ptr[CExpression]] c_children
- cdef Expression child
+ """
+ Construct a projection using expressions.
+
+ A projector is built for a specific schema and vector of expressions.
+ Once the projector is built, it can be used to evaluate many row batches.
+
+ Parameters
+ ----------
+ schema : pyarrow.Schema
+ Schema for the record batches, and the expressions.
+ children : list[pyarrow.gandiva.Expression]
+ List of projectable expression objects.
+ pool : pyarrow.MemoryPool
+ Memory pool used to allocate output arrays.
+ selection_mode : str, default "NONE"
+ Possible values are NONE, UINT16, UINT32, UINT64.
+
+ Returns
+ -------
+ Projector instance
+ """
+ cdef:
+ Expression child
+ c_vector[shared_ptr[CExpression]] c_children
+ shared_ptr[CProjector] result
+
for child in children:
c_children.push_back(child.expression)
- cdef shared_ptr[CProjector] result
+
check_status(
Projector_Make(schema.sp_schema, c_children,
_ensure_selection_mode(selection_mode),
CConfigurationBuilder.DefaultConfiguration(),
&result))
return Projector.create(result, pool)
+
cpdef make_filter(Schema schema, Condition condition):
Review comment:
These functions are only used from the unittest, so we should not expose
them to the public API.
Created a follow-up https://issues.apache.org/jira/browse/ARROW-14996
--
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]