dataframe-core-2.2.0.0: Core data structures for the dataframe library.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Internal.AggPlan

Description

The aggregation fast-path planner and the two-column moment scatter. planAgg recognises a supported aggregate shape over a clean unboxed Int/Double column and returns an AggPlan; momentScatter fuses the six regression sums.

Synopsis

Documentation

data AggPlan Source #

The plan planAgg produces for a recognised output expression. The median plan carries only the column name (the holistic grouped sort lives in the operations layer, where vector-algorithms is available).

Constructors

PlanScatter Reduction Text

A single scatter reduction over one named column.

PlanMaxMinusMin Text Text

max a - min b (Q7): two scatters then a vectorized combine.

PlanMedian Text

Holistic median over one named column.

planAgg :: GroupedDataFrame -> UExpr -> Maybe AggPlan Source #

Inspect a named output expression; return Just plan on a recognised shape over a present clean column, else Nothing. Nullable or non-Int/Double columns are rejected here so the scatter only sees a clean unboxed vector.

data Moments Source #

The additive moment sums of two columns, each an nGroups-length column: (n, Sx, Sy, Sxx, Syy, Sxy).

Constructors

Moments 

Fields

momentScatter :: Vector Int -> Int -> Column -> Column -> Maybe Moments Source #

One pass over two Double-coercible columns x and y filling the count and five sums, collapsing the Q9 regression family's six folds into a single pass. Nothing unless both columns are non-null unboxed Int/Double.

data MomentPlan Source #

A recognised moment (Q9 regression) aggregate group: six output columns that form the sufficient statistics of two base columns x and y. The caller runs momentScatter once and binds each output name to a field of the result.

planMoments :: GroupedDataFrame -> [(Text, UExpr)] -> Maybe MomentPlan Source #

Recognise the moment shape across a whole aggregate list: exactly count, sum(x), sum(y), sum(x*x), sum(y*y), sum(x*y) over two distinct clean unboxed base columns. Nothing on any other set.