Package org.apache.iceberg.expressions
Class ResidualEvaluator
- java.lang.Object
-
- org.apache.iceberg.expressions.ResidualEvaluator
-
- All Implemented Interfaces:
java.io.Serializable
public class ResidualEvaluator extends java.lang.Object implements java.io.SerializableFinds the residuals for anExpressionthe partitions in the givenPartitionSpec.A residual expression is made by partially evaluating an expression using partition values. For example, if a table is partitioned by day(utc_timestamp) and is read with a filter expression utc_timestamp >= a and utc_timestamp <= b, then there are 4 possible residuals expressions for the partition data, d:
- If d > day(a) and d < day(b), the residual is always true
- If d == day(a) and d != day(b), the residual is utc_timestamp >= a
- if d == day(b) and d != day(a), the residual is utc_timestamp <= b
- If d == day(a) == day(b), the residual is utc_timestamp >= a and utc_timestamp <= b
Partition data is passed using
StructLike. Residuals are returned byresidualFor(StructLike).This class is thread-safe.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResidualEvaluatorof(PartitionSpec spec, Expression expr, boolean caseSensitive)Return a residual evaluator for aspecandexpression.ExpressionresidualFor(StructLike partitionData)Returns a residual expression for the given partition values.static ResidualEvaluatorunpartitioned(Expression expr)Return a residual evaluator for an unpartitionedspec.
-
-
-
Method Detail
-
unpartitioned
public static ResidualEvaluator unpartitioned(Expression expr)
Return a residual evaluator for an unpartitionedspec.- Parameters:
expr- an expression- Returns:
- a residual evaluator that always returns the expression
-
of
public static ResidualEvaluator of(PartitionSpec spec, Expression expr, boolean caseSensitive)
Return a residual evaluator for aspecandexpression.- Parameters:
spec- a partition specexpr- an expression- Returns:
- a residual evaluator for the expression
-
residualFor
public Expression residualFor(StructLike partitionData)
Returns a residual expression for the given partition values.- Parameters:
partitionData- partition data values- Returns:
- the residual of this evaluator's expression from the partition values
-
-