java.lang.Object
org.apache.arrow.gandiva.expression.TreeBuilder
Contains helper functions for constructing expression trees.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TreeNode
Invoke this function to create a node representing an and-clause.static TreeNode
makeBinaryLiteral
(byte[] binaryConstant) static Condition
makeCondition
(String function, List<Field> inFields) Short cut to create an expression tree involving a single function, e.g. a+b+c.static Condition
makeCondition
(TreeNode root) Invoke this function to create a condition.static TreeNode
makeDecimalLiteral
(String decimalConstant, int precision, int scale) static ExpressionTree
makeExpression
(String function, List<Field> inFields, Field resultField) Short cut to create an expression tree involving a single function, e.g. a+b+c.static ExpressionTree
makeExpression
(TreeNode root, Field resultField) Invoke this function to create an expression tree.static TreeNode
Invoke this function to create a node representing a field, e.g. a column name.static TreeNode
makeFunction
(String function, List<TreeNode> children, ArrowType retType) Invoke this function to create a node representing a function.static TreeNode
Invoke this function to create a node representing an if-clause.static TreeNode
makeInExpressionBigInt
(TreeNode resultNode, Set<Long> longValues) static TreeNode
makeInExpressionBinary
(TreeNode resultNode, Set<byte[]> binaryValues) static TreeNode
makeInExpressionDecimal
(TreeNode resultNode, Set<BigDecimal> decimalValues, Integer precision, Integer scale) static TreeNode
makeInExpressionDouble
(TreeNode resultNode, Set<Double> doubleValues) static TreeNode
makeInExpressionFloat
(TreeNode resultNode, Set<Float> floatValues) static TreeNode
makeInExpressionInt32
(TreeNode resultNode, Set<Integer> intValues) static TreeNode
makeInExpressionString
(TreeNode resultNode, Set<String> stringValues) static TreeNode
makeLiteral
(Boolean booleanConstant) Helper functions to create literal constants.static TreeNode
makeLiteral
(Double doubleConstant) static TreeNode
makeLiteral
(Float floatConstant) static TreeNode
makeLiteral
(Integer integerConstant) static TreeNode
makeLiteral
(Long longConstant) static TreeNode
create a null literal.static TreeNode
Invoke this function to create a node representing an or-clause.static TreeNode
makeStringLiteral
(String stringConstant)
-
Method Details
-
makeLiteral
Helper functions to create literal constants. -
makeLiteral
-
makeLiteral
-
makeLiteral
-
makeLiteral
-
makeStringLiteral
-
makeBinaryLiteral
-
makeDecimalLiteral
-
makeNull
create a null literal. -
makeField
Invoke this function to create a node representing a field, e.g. a column name.- Parameters:
field
- represents the input argument - includes the name and type of the field- Returns:
- Node representing a field
-
makeFunction
Invoke this function to create a node representing a function.- Parameters:
function
- Name of the function, e.g. addchildren
- The arguments to the functionretType
- The type of the return value of the operator- Returns:
- Node representing a function
-
makeIf
public static TreeNode makeIf(TreeNode condition, TreeNode thenNode, TreeNode elseNode, ArrowType retType) Invoke this function to create a node representing an if-clause.- Parameters:
condition
- Node representing the conditionthenNode
- Node representing the if-blockelseNode
- Node representing the else-blockretType
- Return type of the node- Returns:
- Node representing an if-clause
-
makeAnd
Invoke this function to create a node representing an and-clause.- Parameters:
nodes
- Nodes in the 'and' clause.- Returns:
- Node representing an and-clause
-
makeOr
Invoke this function to create a node representing an or-clause.- Parameters:
nodes
- Nodes in the 'or' clause.- Returns:
- Node representing an or-clause
-
makeExpression
Invoke this function to create an expression tree.- Parameters:
root
- is returned by a call to MakeField, MakeFunction, or MakeIfresultField
- represents the return value of the expression- Returns:
- ExpressionTree referring to the root of an expression tree
-
makeExpression
public static ExpressionTree makeExpression(String function, List<Field> inFields, Field resultField) Short cut to create an expression tree involving a single function, e.g. a+b+c.- Parameters:
function
- Name of the function, e.g. add()inFields
- In arguments to the functionresultField
- represents the return value of the expression- Returns:
- ExpressionTree referring to the root of an expression tree
-
makeCondition
Invoke this function to create a condition.- Parameters:
root
- is returned by a call to MakeField, MakeFunction, MakeIf, ..- Returns:
- condition referring to the root of an expression tree
-
makeCondition
Short cut to create an expression tree involving a single function, e.g. a+b+c.- Parameters:
function
- Name of the function, e.g. add()inFields
- In arguments to the function- Returns:
- condition referring to the root of an expression tree
-
makeInExpressionInt32
-
makeInExpressionBigInt
-
makeInExpressionDecimal
-
makeInExpressionFloat
-
makeInExpressionDouble
-
makeInExpressionString
-
makeInExpressionBinary
-