java.lang.Object
org.apache.arrow.gandiva.evaluator.Projector
This class provides a mechanism to evaluate a set of expressions against a RecordBatch. Follow
these steps to use this class: 1) Use the static method make() to create an instance of this
class that evaluates a set of expressions 2) Invoke the method evaluate() to evaluate these
expressions against a RecordBatch 3) Invoke close() to release resources
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the LLVM module representing this evaluator.void
evaluate
(int numRows, List<ArrowBuf> buffers, List<ValueVector> outColumns) Invoke this function to evaluate a set of expressions against a set of arrow buffers.void
evaluate
(int numRows, List<ArrowBuf> buffers, SelectionVector selectionVector, List<ValueVector> outColumns) Invoke this function to evaluate a set of expressions against a set of arrow buffers on the selected positions.void
evaluate
(ArrowRecordBatch recordBatch, List<ValueVector> outColumns) Invoke this function to evaluate a set of expressions against a recordBatch.void
evaluate
(ArrowRecordBatch recordBatch, SelectionVector selectionVector, List<ValueVector> outColumns) Invoke this function to evaluate a set of expressions against aArrowRecordBatch
.static Projector
make
(Schema schema, List<ExpressionTree> exprs) Invoke this function to generate LLVM code to evaluate the list of project expressions.static Projector
make
(Schema schema, List<ExpressionTree> exprs, boolean optimize) Deprecated.static Projector
make
(Schema schema, List<ExpressionTree> exprs, ConfigurationBuilder.ConfigOptions configOptions) Invoke this function to generate LLVM code to evaluate the list of project expressions.static Projector
make
(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType) Invoke this function to generate LLVM code to evaluate the list of project expressions.static Projector
make
(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, boolean optimize) Deprecated.static Projector
make
(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, long configurationId) Invoke this function to generate LLVM code to evaluate the list of project expressions.static Projector
make
(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, ConfigurationBuilder.ConfigOptions configOptions) Invoke this function to generate LLVM code to evaluate the list of project expressions.
-
Method Details
-
make
Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against data- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
public static Projector make(Schema schema, List<ExpressionTree> exprs, ConfigurationBuilder.ConfigOptions configOptions) throws GandivaException Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataconfigOptions
- ConfigOptions parameter- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
@Deprecated public static Projector make(Schema schema, List<ExpressionTree> exprs, boolean optimize) throws GandivaException Deprecated.Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataoptimize
- Flag to choose if the generated llvm code is to be optimized- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
public static Projector make(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType) throws GandivaException Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataselectionVectorType
- type of selection vector- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
public static Projector make(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, ConfigurationBuilder.ConfigOptions configOptions) throws GandivaException Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataselectionVectorType
- type of selection vectorconfigOptions
- ConfigOptions parameter- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
@Deprecated public static Projector make(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, boolean optimize) throws GandivaException Deprecated.Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataselectionVectorType
- type of selection vectoroptimize
- Flag to choose if the generated llvm code is to be optimized- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
make
public static Projector make(Schema schema, List<ExpressionTree> exprs, GandivaTypes.SelectionVectorType selectionVectorType, long configurationId) throws GandivaException Invoke this function to generate LLVM code to evaluate the list of project expressions. Invoke Projector::Evaluate() against a RecordBatch to evaluate the record batch against these projections.- Parameters:
schema
- Table schema. The field names in the schema should match the fields used to create the TreeNodesexprs
- List of expressions to be evaluated against dataselectionVectorType
- type of selection vectorconfigurationId
- Custom configuration created through config builder.- Returns:
- A native evaluator object that can be used to invoke these projections on a RecordBatch
- Throws:
GandivaException
-
evaluate
public void evaluate(ArrowRecordBatch recordBatch, List<ValueVector> outColumns) throws GandivaException Invoke this function to evaluate a set of expressions against a recordBatch.- Parameters:
recordBatch
- Record batch including the dataoutColumns
- Result of applying the project on the data- Throws:
GandivaException
-
evaluate
public void evaluate(int numRows, List<ArrowBuf> buffers, List<ValueVector> outColumns) throws GandivaException Invoke this function to evaluate a set of expressions against a set of arrow buffers. (this is an optimised version that skips taking references).- Parameters:
numRows
- number of rows.buffers
- List of input arrow buffersoutColumns
- Result of applying the project on the data- Throws:
GandivaException
-
evaluate
public void evaluate(ArrowRecordBatch recordBatch, SelectionVector selectionVector, List<ValueVector> outColumns) throws GandivaException Invoke this function to evaluate a set of expressions against aArrowRecordBatch
.- Parameters:
recordBatch
- The data to evaluate against.selectionVector
- Selection vector which stores the selected rows.outColumns
- Result of applying the project on the data- Throws:
GandivaException
-
evaluate
public void evaluate(int numRows, List<ArrowBuf> buffers, SelectionVector selectionVector, List<ValueVector> outColumns) throws GandivaException Invoke this function to evaluate a set of expressions against a set of arrow buffers on the selected positions. (this is an optimised version that skips taking references).- Parameters:
numRows
- number of rows.buffers
- List of input arrow buffersselectionVector
- Selection vector which stores the selected rows.outColumns
- Result of applying the project on the data- Throws:
GandivaException
-
close
Closes the LLVM module representing this evaluator.- Throws:
GandivaException
-