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

public class Filter extends Object
This class provides a mechanism to filter a RecordBatch by evaluating a condition expression. Follow these steps to use this class: 1) Use the static method make() to create an instance of this class that evaluates a condition. 2) Invoke the method evaluate() to evaluate the filter against a RecordBatch 3) Invoke close() to release resources
  • Method Details

    • make

      public static Filter make(Schema schema, Condition condition) throws GandivaException
      Invoke this function to generate LLVM code to evaluate the condition expression. Invoke Filter::Evaluate() against a RecordBatch to evaluate the filter on this record batch
      Parameters:
      schema - Table schema. The field names in the schema should match the fields used to create the TreeNodes
      condition - condition to be evaluated against data
      Returns:
      A native filter object that can be used to invoke on a RecordBatch
      Throws:
      GandivaException
    • make

      public static Filter make(Schema schema, Condition condition, ConfigurationBuilder.ConfigOptions configOptions) throws GandivaException
      Invoke this function to generate LLVM code to evaluate the condition expression. Invoke Filter::Evaluate() against a RecordBatch to evaluate the filter on this record batch
      Parameters:
      schema - Table schema. The field names in the schema should match the fields used to create the TreeNodes
      condition - condition to be evaluated against data
      configOptions - ConfigOptions parameter
      Returns:
      A native filter object that can be used to invoke on a RecordBatch
      Throws:
      GandivaException
    • make

      @Deprecated public static Filter make(Schema schema, Condition condition, boolean optimize) throws GandivaException
      Deprecated.
      Invoke this function to generate LLVM code to evaluate the condition expression. Invoke Filter::Evaluate() against a RecordBatch to evaluate the filter on this record batch
      Parameters:
      schema - Table schema. The field names in the schema should match the fields used to create the TreeNodes
      condition - condition to be evaluated against data
      optimize - Flag to choose if the generated llvm code is to be optimized
      Returns:
      A native filter object that can be used to invoke on a RecordBatch
      Throws:
      GandivaException
    • make

      public static Filter make(Schema schema, Condition condition, long configurationId) throws GandivaException
      Invoke this function to generate LLVM code to evaluate the condition expression. Invoke Filter::Evaluate() against a RecordBatch to evaluate the filter on this record batch
      Parameters:
      schema - Table schema. The field names in the schema should match the fields used to create the TreeNodes
      condition - condition to be evaluated against data
      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, SelectionVector selectionVector) throws GandivaException
      Invoke this function to evaluate a filter against a recordBatch.
      Parameters:
      recordBatch - Record batch including the data
      selectionVector - Result of applying the filter on the data
      Throws:
      GandivaException
    • evaluate

      public void evaluate(int numRows, List<ArrowBuf> buffers, SelectionVector selectionVector) throws GandivaException
      Invoke this function to evaluate filter 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
      selectionVector - Result of applying the filter on the data
      Throws:
      GandivaException
    • close

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