Interface FilterPredicate
- All Known Implementing Classes:
FilterPredicate.And, FilterPredicate.BinaryColumnPredicate, FilterPredicate.BinaryInPredicate, FilterPredicate.BooleanColumnPredicate, FilterPredicate.DateColumnPredicate, FilterPredicate.DateInPredicate, FilterPredicate.DecimalColumnPredicate, FilterPredicate.DecimalInPredicate, FilterPredicate.DoubleColumnPredicate, FilterPredicate.DoubleInPredicate, FilterPredicate.FloatColumnPredicate, FilterPredicate.FloatInPredicate, FilterPredicate.InstantColumnPredicate, FilterPredicate.InstantInPredicate, FilterPredicate.IntColumnPredicate, FilterPredicate.IntersectsPredicate, FilterPredicate.IntervalColumnPredicate, FilterPredicate.IntervalInPredicate, FilterPredicate.IntInPredicate, FilterPredicate.IsNotNullPredicate, FilterPredicate.IsNullPredicate, FilterPredicate.LocalDateTimeColumnPredicate, FilterPredicate.LocalDateTimeInPredicate, FilterPredicate.LongColumnPredicate, FilterPredicate.LongInPredicate, FilterPredicate.Not, FilterPredicate.Or, FilterPredicate.StringColumnPredicate, FilterPredicate.StringInPredicate, FilterPredicate.TimeColumnPredicate, FilterPredicate.TimeInPredicate, FilterPredicate.UUIDColumnPredicate, FilterPredicate.UUIDInPredicate
A predicate filtering the rows a reader returns.
A reader returns exactly the rows the predicate matches, except for intersects(String, double, double, double, double), which
decides whole row groups. It also pushes the predicate down: row groups and pages whose
statistics, dictionary or Bloom filter prove that no row can match are skipped without being
decoded. A literal is a value the column's accessors return; the Query Controls reference lists
the literals and operators each column type takes.
Usage examples:
// Simple comparison
FilterPredicate filter = FilterPredicate.gt("age", 21);
// Compound predicate
FilterPredicate filter = FilterPredicate.and(
FilterPredicate.gtEq("salary", 50000L),
FilterPredicate.lt("age", 65)
);
// Use with reader
try (ColumnReader reader = fileReader.buildColumnReader("salary").filter(filter).build()) {
while (reader.nextBatch()) { ... }
}
Null handling
All comparison predicates (eq, notEq, lt, ltEq, gt, gtEq, in)
follow SQL three-valued logic: comparing a null column value
against any operand yields UNKNOWN, and rows whose predicate is UNKNOWN are
not returned. In practice this means rows with a null in the tested column
are never returned by a comparison predicate. Use isNull / isNotNull
for explicit null checks, or or(...) to include null rows alongside a
comparison — e.g. or(gt("age", 30), isNull("age")).
not(p) preserves this behavior: rows where p is UNKNOWN stay UNKNOWN
under negation and are dropped. The SQL identity not(gt(x, v)) ≡ ltEq(x, v)
holds on all rows, including null ones.
This matches the SQL semantics of WHERE predicates and differs from
parquet-java's notEq, which treats null <> v as true and therefore
includes null rows. To reproduce parquet-java's behavior in Hardwood, write
the null-inclusion explicitly: or(notEq("x", v), isNull("x")).
Float and double comparisons
Predicates on float and double columns use the Float.compare(float, float) /
Double.compare(double, double) total order, not IEEE 754 equality. Two consequences
matter in practice:
-0.0is strictly less than+0.0.eq(0.0)matches only+0.0values; to match either zero, usein(column, 0.0, -0.0).NaNsorts above every other value, and everyNaNequals every other.eq(NaN)matches onlyNaN(whereas IEEENaN == anythingis always false).ltagainst any value, andltEqagainst a number, never matchNaNrows;gtandgtEqagainst a number, andltEqandgtEqagainstNaN, include them.
in(column, float...) and in(column, double...) apply the same total order to each
listed value. in(column, float...) takes a FLOAT or FLOAT16 column and
in(column, double...) a DOUBLE column, as eq does.
Row-group and page pruning never drops a NaN row that a predicate
matches. Statistics whose min or max is NaN are not used for pruning.
A predicate that a NaN value satisfies — notEq, gt or gtEq against
a number, or eq, ltEq or gtEq against NaN — prunes a FLOAT,
DOUBLE or FLOAT16 column from its statistics only where the row group
or page records a nan_count of zero.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic final recordPredicate for a binary column over its stored bytes.static final recordSet-membership predicate for a binary column.static final recordstatic final recordPredicate for DATE columns.static final recordSet-membership predicate for DATE columns.static final recordPredicate for DECIMAL columns.static final recordSet-membership predicate for DECIMAL columns.static final recordstatic final recordstatic final recordstatic final recordstatic final recordPredicate for TIMESTAMP columns withisAdjustedToUTC = trueand for legacyINT96timestamp columns.static final recordSet-membership predicate for the columns anFilterPredicate.InstantColumnPredicatetakes.static final recordstatic final recordPredicate for spatial bounding box.static final recordPredicate for anINTERVALcolumn, comparing the twelve stored bytes as the three unsigned 32-bit components they encode.static final recordSet-membership predicate for anINTERVALcolumn.static final recordstatic final recordPredicate that matches rows where the column value is not null.static final recordPredicate that matches rows where the column value is null.static final recordPredicate for TIMESTAMP columns withisAdjustedToUTC = false.static final recordSet-membership predicate for TIMESTAMP columns withisAdjustedToUTC = false.static final recordstatic final recordstatic final recordstatic enumstatic final recordstatic final recordPredicate for a text column, comparing the literal's UTF-8 bytes.static final recordSet-membership predicate for a text column.static final recordPredicate for TIME columns.static final recordSet-membership predicate for TIME columns.static final recordstatic final recordSet-membership predicate for UUID columns, each probe compared as its 16 big-endian bytes. -
Method Summary
Modifier and TypeMethodDescriptionstatic FilterPredicateand(FilterPredicate... filters) Creates a conjunction offilters.static FilterPredicateand(FilterPredicate left, FilterPredicate right) static FilterPredicatestatic FilterPredicateCreates an equals predicate for a binary column, whose literal is the stored bytes — the valueStructAccessor.getBinary(int)returns for it.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicateeq(String column, PqInterval value) Creates an equals predicate for anINTERVALcolumn, whose literal is thePqIntervalStructAccessor.getInterval(int)returns for it.static FilterPredicateCreates an equals predicate for a text column, one ofSTRING,ENUM,JSONand an unannotatedBYTE_ARRAY.static FilterPredicateeq(String column, BigDecimal value) Creates an equals predicate for aBigDecimalcolumn (Parquet DECIMAL logical type).static FilterPredicateCreates an equals predicate for anInstantcolumn (Parquet TIMESTAMP logical type withisAdjustedToUTC = true, or a legacyINT96timestamp).static FilterPredicateCreates an equals predicate for aLocalDatecolumn (Parquet DATE logical type).static FilterPredicateeq(String column, LocalDateTime value) Creates an equals predicate for aLocalDateTimecolumn (Parquet TIMESTAMP logical type withisAdjustedToUTC = false).static FilterPredicateCreates an equals predicate for aLocalTimecolumn (Parquet TIME logical type).static FilterPredicateCreates an equals predicate for aUUIDcolumn (Parquet UUID logical type).static FilterPredicateCreates a greater-than predicate for aBOOLEANcolumn.static FilterPredicateCreates a greater-than predicate for a binary column.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicateCreates a greater-than predicate for a text column.static FilterPredicategt(String column, BigDecimal value) Creates a greater-than predicate for aBigDecimalcolumn.static FilterPredicateCreates a greater-than predicate for anInstantcolumn.static FilterPredicateCreates a greater-than predicate for aLocalDatecolumn.static FilterPredicategt(String column, LocalDateTime value) Creates a greater-than predicate for aLocalDateTimecolumn.static FilterPredicateCreates a greater-than predicate for aLocalTimecolumn.static FilterPredicateCreates a greater-than predicate for aUUIDcolumn.static FilterPredicateCreates a greater-than-or-equal predicate for aBOOLEANcolumn.static FilterPredicateCreates a greater-than-or-equal predicate for a binary column.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicateCreates a greater-than-or-equal predicate for a text column.static FilterPredicategtEq(String column, BigDecimal value) Creates a greater-than-or-equal predicate for aBigDecimalcolumn.static FilterPredicateCreates a greater-than-or-equal predicate for anInstantcolumn.static FilterPredicateCreates a greater-than-or-equal predicate for aLocalDatecolumn.static FilterPredicategtEq(String column, LocalDateTime value) Creates a greater-than-or-equal predicate for aLocalDateTimecolumn.static FilterPredicateCreates a greater-than-or-equal predicate for aLocalTimecolumn.static FilterPredicateCreates a greater-than-or-equal predicate for aUUIDcolumn.static FilterPredicateCreates a set-membership predicate for a binary column, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for aDOUBLEcolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for aFLOATorFLOAT16column, matching a row whose value is any ofvalues.static FilterPredicatestatic FilterPredicatestatic FilterPredicatein(String column, PqInterval... values) Creates a set-membership predicate for anINTERVALcolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for a text column, matching a row whose value is any ofvalues.static FilterPredicatein(String column, BigDecimal... values) Creates a set-membership predicate for aBigDecimalcolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for anInstantcolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for aLocalDatecolumn, matching a row whose value is any ofvalues.static FilterPredicatein(String column, LocalDateTime... values) Creates a set-membership predicate for aLocalDateTimecolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for aLocalTimecolumn, matching a row whose value is any ofvalues.static FilterPredicateCreates a set-membership predicate for aUUIDcolumn, matching a row whose value is any ofvalues.static FilterPredicateDeprecated.static FilterPredicateintersects(String column, double xmin, double ymin, double xmax, double ymax) Creates a predicate that matches column chunks whose bounding box intersects the given bounding box.static FilterPredicateCreates a predicate that matches rows where the given column is not null.static FilterPredicateCreates a predicate that matches rows where the given column is null.static FilterPredicateCreates a less-than predicate for aBOOLEANcolumn, which ordersfalsebeforetrue:lt(column, true)matches the rows holdingfalse, andlt(column, false)matches none.static FilterPredicateCreates a less-than predicate for a binary column.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicateCreates a less-than predicate for a text column.static FilterPredicatelt(String column, BigDecimal value) Creates a less-than predicate for aBigDecimalcolumn.static FilterPredicateCreates a less-than predicate for anInstantcolumn.static FilterPredicateCreates a less-than predicate for aLocalDatecolumn.static FilterPredicatelt(String column, LocalDateTime value) Creates a less-than predicate for aLocalDateTimecolumn.static FilterPredicateCreates a less-than predicate for aLocalTimecolumn.static FilterPredicateCreates a less-than predicate for aUUIDcolumn.static FilterPredicateCreates a less-than-or-equal predicate for aBOOLEANcolumn.static FilterPredicateCreates a less-than-or-equal predicate for a binary column.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicateCreates a less-than-or-equal predicate for a text column.static FilterPredicateltEq(String column, BigDecimal value) Creates a less-than-or-equal predicate for aBigDecimalcolumn.static FilterPredicateCreates a less-than-or-equal predicate for anInstantcolumn.static FilterPredicateCreates a less-than-or-equal predicate for aLocalDatecolumn.static FilterPredicateltEq(String column, LocalDateTime value) Creates a less-than-or-equal predicate for aLocalDateTimecolumn.static FilterPredicateCreates a less-than-or-equal predicate for aLocalTimecolumn.static FilterPredicateCreates a less-than-or-equal predicate for aUUIDcolumn.static FilterPredicatenot(FilterPredicate filter) static FilterPredicatestatic FilterPredicateCreates a not-equals predicate for a binary column.static FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatestatic FilterPredicatenotEq(String column, PqInterval value) Creates a not-equals predicate for anINTERVALcolumn.static FilterPredicateCreates a not-equals predicate for a text column.static FilterPredicatenotEq(String column, BigDecimal value) Creates a not-equals predicate for aBigDecimalcolumn.static FilterPredicateCreates a not-equals predicate for anInstantcolumn.static FilterPredicateCreates a not-equals predicate for aLocalDatecolumn.static FilterPredicatenotEq(String column, LocalDateTime value) Creates a not-equals predicate for aLocalDateTimecolumn.static FilterPredicateCreates a not-equals predicate for aLocalTimecolumn.static FilterPredicateCreates a not-equals predicate for aUUIDcolumn.static FilterPredicateor(FilterPredicate... filters) Creates a disjunction offilters.static FilterPredicateor(FilterPredicate left, FilterPredicate right)
-
Method Details
-
eq
-
notEq
-
lt
-
ltEq
-
gt
-
gtEq
-
eq
-
notEq
-
lt
-
ltEq
-
gt
-
gtEq
-
eq
-
notEq
-
lt
-
ltEq
-
gt
-
gtEq
-
in
Creates a set-membership predicate for aFLOATorFLOAT16column, matching a row whose value is any ofvalues. Each probe is an equality literal, so on aFLOAT16column a probe no IEEE half represents throwsIllegalArgumentExceptionat reader creation. -
eq
-
notEq
-
lt
-
ltEq
-
gt
-
gtEq
-
eq
-
notEq
-
lt
Creates a less-than predicate for aBOOLEANcolumn, which ordersfalsebeforetrue:lt(column, true)matches the rows holdingfalse, andlt(column, false)matches none. -
ltEq
Creates a less-than-or-equal predicate for aBOOLEANcolumn. Seelt(String,boolean). -
gt
Creates a greater-than predicate for aBOOLEANcolumn. Seelt(String,boolean). -
gtEq
Creates a greater-than-or-equal predicate for aBOOLEANcolumn. Seelt(String,boolean). -
eq
Creates an equals predicate for a text column, one ofSTRING,ENUM,JSONand an unannotatedBYTE_ARRAY. The value compares as its UTF-8 bytes, which is what such a column stores. A row storing bytes that are not well-formed UTF-8 matches noString, including the onegetStringreturns for it; filter it with itsbyte[]. Any other column rejects aStringwithIllegalArgumentExceptionat reader creation. -
notEq
Creates a not-equals predicate for a text column. Seeeq(String,String). -
lt
Creates a less-than predicate for a text column. Seeeq(String,String). -
ltEq
Creates a less-than-or-equal predicate for a text column. Seeeq(String,String). -
gt
Creates a greater-than predicate for a text column. Seeeq(String,String). -
gtEq
Creates a greater-than-or-equal predicate for a text column. Seeeq(String,String). -
eq
Creates an equals predicate for a binary column, whose literal is the stored bytes — the value
StructAccessor.getBinary(int)returns for it. A row matches when it stores exactly these bytes.Ordered predicates compare the bytes unsigned lexicographically. A
DECIMAL, aFLOAT16, a legacyINT96timestamp and aFIXED_LEN_BYTE_ARRAY(12)TIMESTAMPcolumn order by the value their bytes encode, and take abyte[]foreq,notEqandinonly; an ordered predicate on one takes aBigDecimal, afloat, anInstantor aLocalDateTime. A fixed-width column takes an equality literal of its own width only, aFLOAT16two bytes and anINT96twelve.The array is copied, so a caller reusing it does not change the predicate.
-
notEq
Creates a not-equals predicate for a binary column. See [#eq(String,byte[])]. -
lt
Creates a less-than predicate for a binary column. See [#eq(String,byte[])]. -
ltEq
Creates a less-than-or-equal predicate for a binary column. See [#eq(String,byte[])]. -
gt
Creates a greater-than predicate for a binary column. See [#eq(String,byte[])]. -
gtEq
Creates a greater-than-or-equal predicate for a binary column. See [#eq(String,byte[])]. -
in
Creates a set-membership predicate for a binary column, matching a row whose value is any ofvalues. Each probe is an equality literal and compares as [#eq(String,byte[])] describes. The arrays are copied. -
in
-
in
-
in
Creates a set-membership predicate for aDOUBLEcolumn, matching a row whose value is any ofvalues. -
inStrings
Deprecated.usein(String,String...), which builds the same predicateCreates a set-membership predicate for a text column, matching a row whose value is any ofvalues. Each probe compares aseq(String,String)describes. -
in
Creates a set-membership predicate for a text column, matching a row whose value is any ofvalues. Each probe compares aseq(String,String)describes. -
eq
Creates an equals predicate for aLocalDatecolumn (Parquet DATE logical type). The column must carry theDATElogical type; the date is converted to days since the Unix epoch at reader creation. -
notEq
Creates a not-equals predicate for aLocalDatecolumn. -
lt
Creates a less-than predicate for aLocalDatecolumn. -
ltEq
Creates a less-than-or-equal predicate for aLocalDatecolumn. -
gt
Creates a greater-than predicate for aLocalDatecolumn. -
gtEq
Creates a greater-than-or-equal predicate for aLocalDatecolumn. -
in
Creates a set-membership predicate for aLocalDatecolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,LocalDate). -
eq
Creates an equals predicate for anInstantcolumn (Parquet TIMESTAMP logical type withisAdjustedToUTC = true, or a legacyINT96timestamp). The column's time unit is determined from the schema at reader creation. -
notEq
Creates a not-equals predicate for anInstantcolumn. -
lt
Creates a less-than predicate for anInstantcolumn. -
ltEq
Creates a less-than-or-equal predicate for anInstantcolumn. -
gt
Creates a greater-than predicate for anInstantcolumn. -
gtEq
Creates a greater-than-or-equal predicate for anInstantcolumn. -
in
Creates a set-membership predicate for anInstantcolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,Instant). -
eq
Creates an equals predicate for aLocalDateTimecolumn (Parquet TIMESTAMP logical type withisAdjustedToUTC = false). The column's time unit is determined from the schema at reader creation. -
notEq
Creates a not-equals predicate for aLocalDateTimecolumn. -
lt
Creates a less-than predicate for aLocalDateTimecolumn. -
ltEq
Creates a less-than-or-equal predicate for aLocalDateTimecolumn. -
gt
Creates a greater-than predicate for aLocalDateTimecolumn. -
gtEq
Creates a greater-than-or-equal predicate for aLocalDateTimecolumn. -
in
Creates a set-membership predicate for aLocalDateTimecolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,LocalDateTime). -
eq
Creates an equals predicate for aLocalTimecolumn (Parquet TIME logical type). The column's time unit is determined from the schema at reader creation. -
notEq
Creates a not-equals predicate for aLocalTimecolumn. -
lt
Creates a less-than predicate for aLocalTimecolumn. -
ltEq
Creates a less-than-or-equal predicate for aLocalTimecolumn. -
gt
Creates a greater-than predicate for aLocalTimecolumn. -
gtEq
Creates a greater-than-or-equal predicate for aLocalTimecolumn. -
in
Creates a set-membership predicate for aLocalTimecolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,LocalTime). -
eq
Creates an equals predicate for aBigDecimalcolumn (Parquet DECIMAL logical type). The column's scale and physical type are read from the schema at reader creation, and the value is rescaled to the column's scale, padded where the column holds more. An equality literal carrying a digit the column's scale cannot hold, or a value past the range of the column's physical type, throwsIllegalArgumentExceptionat reader creation; an ordered predicate on such a literal is answered exactly. -
notEq
Creates a not-equals predicate for aBigDecimalcolumn. -
lt
Creates a less-than predicate for aBigDecimalcolumn. -
ltEq
Creates a less-than-or-equal predicate for aBigDecimalcolumn. -
gt
Creates a greater-than predicate for aBigDecimalcolumn. -
gtEq
Creates a greater-than-or-equal predicate for aBigDecimalcolumn. -
in
Creates a set-membership predicate for aBigDecimalcolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,BigDecimal). -
eq
Creates an equals predicate for aUUIDcolumn (Parquet UUID logical type). The UUID is encoded as a 16-byte big-endianFIXED_LEN_BYTE_ARRAY. -
notEq
Creates a not-equals predicate for aUUIDcolumn. -
lt
Creates a less-than predicate for aUUIDcolumn. -
ltEq
Creates a less-than-or-equal predicate for aUUIDcolumn. -
gt
Creates a greater-than predicate for aUUIDcolumn. -
gtEq
Creates a greater-than-or-equal predicate for aUUIDcolumn. -
in
Creates a set-membership predicate for aUUIDcolumn, matching a row whose value is any ofvalues. -
eq
Creates an equals predicate for an
INTERVALcolumn, whose literal is thePqIntervalStructAccessor.getInterval(int)returns for it. The column must carry theINTERVALannotation.The format defines no order over intervals — there is no fixed conversion between months, days and milliseconds — so
lt,ltEq,gtandgtEqon anINTERVALcolumn throwIllegalArgumentExceptionat reader creation. Each component is stored as an unsigned 32-bit value, so one outside[0, 4294967295]throws there as well. -
notEq
Creates a not-equals predicate for anINTERVALcolumn. Seeeq(String,PqInterval). -
in
Creates a set-membership predicate for anINTERVALcolumn, matching a row whose value is any ofvalues. Each probe is an equality literal, as foreq(String,PqInterval). -
isNull
Creates a predicate that matches rows where the given column is null. -
isNotNull
Creates a predicate that matches rows where the given column is not null. -
intersects
static FilterPredicate intersects(String column, double xmin, double ymin, double xmax, double ymax) Creates a predicate that matches column chunks whose bounding box intersects the given bounding box.
A box with
xmin > xmaxwraps across the antimeridian, coveringx >= xminorx <= xmax. ANaNbound throwsIllegalArgumentException.The rows a bounding box does not cover are not a bounding box, so the predicate has no inverse:
notover it, or over any predicate holding one, throwsIllegalArgumentExceptionat reader creation. -
and
-
and
Creates a conjunction offilters. At least one is required; none throwsIllegalArgumentException. -
or
-
or
Creates a disjunction offilters. At least one is required; none throwsIllegalArgumentException. -
not
-
in(String,String...), which builds the same predicate