Class ResidualEvaluator

  • All Implemented Interfaces:
    java.io.Serializable

    public class ResidualEvaluator
    extends java.lang.Object
    implements java.io.Serializable
    Finds the residuals for an Expression the partitions in the given PartitionSpec.

    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 by residualFor(StructLike).

    This class is thread-safe.

    See Also:
    Serialized Form
    • Method Detail

      • unpartitioned

        public static ResidualEvaluator unpartitioned​(Expression expr)
        Return a residual evaluator for an unpartitioned spec.
        Parameters:
        expr - an expression
        Returns:
        a residual evaluator that always returns 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