Class SqlToRelConverter.HistogramShuttle

  • All Implemented Interfaces:
    Enclosing class:

    private class SqlToRelConverter.HistogramShuttle
    extends RexShuttle
    Shuttle which walks over a tree of RexNodes and applies 'over' to all agg functions.

    This is necessary because the returned expression is not necessarily a call to an agg function. For example,



    SUM(x) / COUNT(x)

    Any aggregate functions are converted to calls to the internal $Histogram aggregation function and accessors such as $HistogramMin; for example,

    MIN(x), MAX(x)

    are converted to

    $HistogramMin($Histogram(x)), $HistogramMax($Histogram(x))

    Common sub-expression elimination will ensure that only one histogram is computed.

    • Field Detail


        static final boolean ENABLE_HISTOGRAM_AGG
        Whether to convert calls to MIN(x) to HISTOGRAM_MIN(HISTOGRAM(x)). Histograms allow rolling computation, but require more space.
        See Also:
        Constant Field Values
      • partitionKeys

        private final java.util.List<RexNode> partitionKeys
      • orderKeys

        private final<RexFieldCollation> orderKeys
      • distinct

        private final boolean distinct
      • ignoreNulls

        private final boolean ignoreNulls