java.lang.Object
org.apache.arrow.gandiva.evaluator.Projector

public class Projector extends Object
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 Details

    • make

      public static Projector make(Schema schema, List<ExpressionTree> exprs) 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 TreeNodes
      exprs - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      configOptions - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      optimize - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      selectionVectorType - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      selectionVectorType - type of selection vector
      configOptions - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      selectionVectorType - type of selection vector
      optimize - 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 TreeNodes
      exprs - List of expressions to be evaluated against data
      selectionVectorType - type of selection vector
      configurationId - 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 data
      outColumns - 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 buffers
      outColumns - 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 a ArrowRecordBatch.
      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 buffers
      selectionVector - Selection vector which stores the selected rows.
      outColumns - Result of applying the project on the data
      Throws:
      GandivaException
    • close

      public void close() throws GandivaException
      Closes the LLVM module representing this evaluator.
      Throws:
      GandivaException