Interface RowPredicate

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RowPredicate
Tests one row in an Arrow batch.

Used by BuiltinOp.filter(org.apache.arrow.memory.BufferAllocator, RowPredicate), which calls the predicate once per row and copies the passing rows into a new batch. Read vectors by name, cast to the concrete Arrow vector type, and check isNull(row) before reading a nullable column: the typed accessors do not.

Example

RowPredicate largeAmount = (batch, row) -> {
    var amounts = (BigIntVector) batch.getVector("amount");
    return !amounts.isNull(row) && amounts.get(row) > 4;
};
var filter = BuiltinOp.filter(allocator, largeAmount);
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    test(org.apache.arrow.vector.VectorSchemaRoot batch, int row)
    Decides whether a row is kept.
  • Method Details

    • test

      boolean test(org.apache.arrow.vector.VectorSchemaRoot batch, int row)
      Decides whether a row is kept.
      Parameters:
      batch - the batch the row belongs to; the predicate must not modify or close it
      row - the row index to test
      Returns:
      true to keep the row, false to drop it