Class WholePartitionAggregates

java.lang.Object
dev.frostlake.functions.window.WholePartitionAggregates

public final class WholePartitionAggregates extends Object
The aggregates that, used as a WINDOW, may only see the WHOLE partition. Live refuses every frame that shows one of them a moving subset of the partition at compile time rather than answering over the subset — and the family is far wider than the ranking aggregates it was first measured on. Swept name by name against seven frame shapes:
   MEDIAN(n) OVER ()                     answers
   MEDIAN(n) OVER (PARTITION BY g)       answers
   MEDIAN(n) OVER (ORDER BY n)           Cumulative window frame unsupported for function MEDIAN
   … ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING   answers
 

★ THE ORDER BY IS THE FAULT, NOT THE FRAME. A specification with no ORDER BY has no frame to complain about and is answered; one WITH an ORDER BY carries an implicit cumulative frame even when none is written, which is why the bare OVER (ORDER BY n) is refused at the OVER keyword while a written frame is refused at its own.

★ THE WHOLE-PARTITION ROWS FRAME IS THE ONE EXCEPTION, because it re-states what these functions already do. Its RANGE spelling is not: live elides the frame there and then refuses the ORDER BY it is left holding, in a different sentence entirely — except for KURTOSIS and SKEW, which answer the RANGE spelling and refuse only the cumulative and sliding frames.

★ THE FAMILY: the ranking aggregates (MEDIAN, MODE, the percentiles), the approximate family (APPROX_PERCENTILE and its accumulator, APPROX_TOP_K, APPROX_COUNT_DISTINCT / HLL), LISTAGG with or without WITHIN GROUP, the correlation and regression family (CORR, COVAR_*, REGR_*), the moments (KURTOSIS, SKEW), ANY_VALUE, MIN_BY / MAX_BY, OBJECT_AGG, ARRAY_UNIQUE_AGG, HASH_AGG and the bitwise and boolean aggregates. Measured EXEMPT — every frame answers — are SUM, AVG, COUNT, COUNT_IF, COUNT(DISTINCT), MIN, MAX, VARIANCE, STDDEV and ARRAY_AGG without WITHIN GROUP; the refusals are keyed on the names here and nothing else.

  • Method Details

    • coversWholePartitionOnly

      public static boolean coversWholePartitionOnly(String name)
      Whether this aggregate may only be windowed over a whole partition.
      Parameters:
      name - the upper-cased function name
      Returns:
      true when it is one of the family
    • answersWholeRangeFrame

      public static boolean answersWholeRangeFrame(String name)
      Whether the whole-partition RANGE spelling is answered for this member rather than refused as an unsupported ORDER BY — true for the two moments alone (live-verified).
      Parameters:
      name - the upper-cased function name
      Returns:
      true when the RANGE frame answers