T - The type of the column this predicate is applied to.public abstract class UserDefinedPredicate<T extends Comparable<T>> extends Object
FilterApi.| Constructor and Description |
|---|
UserDefinedPredicate()
A udp must have a default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
canDrop(Statistics<T> statistics)
Given information about a group of records (eg, the min and max value)
Return true to drop all the records in this group, false to keep them for further
inspection.
|
abstract boolean |
inverseCanDrop(Statistics<T> statistics)
Same as
canDrop(org.apache.parquet.filter2.predicate.Statistics<T>) except this method describes the logical inverse
behavior of this predicate. |
abstract boolean |
keep(T value)
Return true to keep the record with this value, false to drop it.
|
public UserDefinedPredicate()
FilterApi will not be serialized along with its state.
Only its class name will be recorded, it will be instantiated reflectively via the default
constructor.public abstract boolean keep(T value)
public abstract boolean canDrop(Statistics<T> statistics)
keep(T) to make the final decision.
It is safe to always return false here, if you simply want to visit each record via the keep(T) method,
though it is much more efficient to drop entire chunks of records here if you can.public abstract boolean inverseCanDrop(Statistics<T> statistics)
canDrop(org.apache.parquet.filter2.predicate.Statistics<T>) except this method describes the logical inverse
behavior of this predicate. If this predicate is passed to the not() operator, then
inverseCanDrop(org.apache.parquet.filter2.predicate.Statistics<T>) will be called instead of canDrop(org.apache.parquet.filter2.predicate.Statistics<T>)
It is safe to always return false here, if you simply want to visit each record via the keep(T) method,
though it is much more efficient to drop entire chunks of records here if you can.
It may be valid to simply return !canDrop(statistics) but that is not always the case.
To illustrate, look at this re-implementation of a UDP that checks for values greater than 7:
// This is just an example, you should use the built in {@link FilterApi#gt} operator instead of
// implementing your own like this.
public class IntGreaterThan7UDP extends UserDefinedPredicateCopyright © 2015 The Apache Software Foundation. All rights reserved.