pyarrow.gandiva.TreeExprBuilder

class pyarrow.gandiva.TreeExprBuilder

Bases: pyarrow.lib._Weakrefable

Builder class used to generate Gandiva expression nodes.

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__()

Initialize self.

make_and(self, children)

Create an ‘and’ Node.

make_condition(self, Node condition)

Create a Condition from a boolean node.

make_expression(self, Node root_node, …)

Create an Expression from a Node and an output Field.

make_field(self, Field field)

Create a field node, representing a column in a record batch.

make_function(self, name, children, …)

Create a function node.

make_if(self, Node condition, …)

Create an if-else node.

make_in_expression(self, Node node, values, …)

Create a Node representing an ‘is in’ check.

make_literal(self, value, dtype)

Create a node representing a literal value.

make_or(self, children)

Create an ‘or’ Node.

make_and(self, children)

Create an ‘and’ Node.

Parameters

children (Iterable[Node]) – Boolean nodes to ‘and’ together

Returns

Node

make_condition(self, Node condition)

Create a Condition from a boolean node.

Parameters

condition (Node) – A boolean node

Returns

Condition

make_expression(self, Node root_node, Field return_field)

Create an Expression from a Node and an output Field.

Parameters
  • root_node (Node) – Node representing expression

  • return_field (pyarrow.Field) – PyArrow field to use in projected result for the expression

Returns

Expression

make_field(self, Field field)

Create a field node, representing a column in a record batch.

Parameters

field (pyarrow.Field) – Field to represent in node.

Returns

Node

make_function(self, name, children, DataType return_type)

Create a function node.

Will match to a registered Gandiva function based on the name, children data types, and return_type.

Parameters
  • name (str) – Name of function.

  • children (List[Node]) – List of Nodes to be arguments to the function.

  • return_type (pyarrow.DataType) – Return type of the function to use.

Returns

Node

See also

pyarrow.gandiva.get_registered_function_signatures()

Provides list of available functions.

make_if(self, Node condition, Node this_node, Node else_node, DataType return_type)

Create an if-else node.

Parameters
  • condition (Node) – A Boolean node

  • this_node (Node) – Node to use as value if condition is true

  • else_node (Node) – Node to use if condition is false

  • return_type (pyarrow.DataType) – Data type of result

Returns

Node

make_in_expression(self, Node node, values, dtype)

Create a Node representing an ‘is in’ check.

Values are a fixed list of values.

Parameters
  • node (Node) – Node representing values to perform check on

  • values (Iterable[bool, int, float or string]) – A fixed list of values

  • dtype (DataType) – Data type of the values

Returns

Node

make_literal(self, value, dtype)

Create a node representing a literal value.

Parameters
  • value (bool, int, float or string) – Literal value to represent

  • dtype (pyarrow.DataType) – Arrow data type of the value.

Returns

Node

make_or(self, children)

Create an ‘or’ Node.

Parameters

children (Iterable[Node]) – Boolean nodes to ‘or’ together

Returns

Node