Class Aggregation

java.lang.Object
io.deephaven.web.client.api.agg.Aggregation
Direct Known Subclasses:
ColumnAggregation, Count, CountWhere, FirstRowKey, Formula, LastRowKey, Partition

@JsType(namespace="dh.agg") public abstract sealed class Aggregation extends Object permits ColumnAggregation, Count, CountWhere, Formula, Partition, FirstRowKey, LastRowKey
Base sealed type for all aggregation definitions.

Column-based aggregations (those backed by an AggSpec and optional input/output column pairs) extend ColumnAggregation. Non-column aggregations that produce a single output column or have special semantics (Count, CountWhere, Partition, FirstRowKey, LastRowKey) extend this class directly.

Each concrete subtype carries a type field whose compile-time constant value acts as a discriminant, enabling TypeScript consumers to narrow the union of all of them, dh.agg.AggregationUnion, via switch (agg.type).

See Also:
  • Constructor Details

    • Aggregation

      public Aggregation()
  • Method Details

    • AggSum

      @JsMethod public static Sum AggSum(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Sum aggregation.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggAbsSum

      @JsMethod public static AbsSum AggAbsSum(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates an absolute-sum aggregation.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggAvg

      @JsMethod public static Avg AggAvg(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates an Average (arithmetic mean) aggregation.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggFirst

      @JsMethod public static First AggFirst(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a First aggregation, returning the first value in each group.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggFreeze

      @JsMethod public static Freeze AggFreeze(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Freeze aggregation, which keeps the first value seen and ignores subsequent changes.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggGroup

      @JsMethod public static Group AggGroup(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Group aggregation, collecting values into arrays.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggLast

      @JsMethod public static Last AggLast(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Last aggregation, returning the last value in each group.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggMax

      @JsMethod public static Max AggMax(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Max aggregation.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggMin

      @JsMethod public static Min AggMin(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Min aggregation.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggStd

      @JsMethod public static Std AggStd(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Std (sample standard deviation) aggregation, computed using Bessel's correction.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggVar

      @JsMethod public static Var AggVar(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Var (sample variance) aggregation, computed using Bessel's correction.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggMed

      @JsMethod public static Median AggMed(@JsOptional @JsNullable Boolean averageEvenlyDivided, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Median aggregation.
      Parameters:
      averageEvenlyDivided - when the group size is even, whether to average the two middle values. When true, averages the two middle values. When false, uses the larger value. Only int, long, float and double columns are averaged. Defaults to true.
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggPct

      @JsMethod public static Percentile AggPct(double percentile, @JsOptional @JsNullable Boolean averageEvenlyDivided, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Percentile aggregation.
      Parameters:
      percentile - the percentile to calculate, must be in the range [0.0, 1.0]
      averageEvenlyDivided - whether to average the two boundary values when the percentile falls evenly between them. Only int, long, float and double columns are averaged. Defaults to false if not specified
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggApproxPct

      @JsMethod public static ApproxPercentile AggApproxPct(double percentile, @JsOptional @JsNullable Double compression, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates an Approximate Percentile aggregation using T-Digest.
      Parameters:
      percentile - the percentile to calculate, must be in the range [0.0, 1.0]
      compression - T-Digest compression factor, which must be ≥ 1. Values above 1000 are not recommended. If null, the server chooses a default.
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggCountDistinct

      @JsMethod public static CountDistinct AggCountDistinct(@JsOptional @JsNullable Boolean countNulls, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Count Distinct aggregation, counting the number of distinct values in each group.
      Parameters:
      countNulls - whether null values should be counted as distinct values
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggDistinct

      @JsMethod public static Distinct AggDistinct(@JsOptional @JsNullable Boolean includeNulls, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Distinct aggregation, collecting the distinct values within each group as arrays.
      Parameters:
      includeNulls - whether null values should be included in the distinct output values. Defaults to false.
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggUnique

      @JsMethod public static Unique AggUnique(@JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns, @JsOptional @JsNullable Boolean includeNulls, @JsOptional @JsNullable Unique.NonUniqueSentinelUnion nonUniqueSentinel)
      Creates a Unique aggregation, returning the single unique value within each group. If there is more than one distinct value, the result is nonUniqueSentinel.
      Parameters:
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      includeNulls - whether null is treated as a value for determining uniqueness. Defaults to false.
      nonUniqueSentinel - the value for a group with more than one distinct value. Defaults to null.
      Returns:
      an aggregation
    • AggWAvg

      @JsMethod public static WAvg AggWAvg(Column.ColumnOrName weightColumn, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Weighted Average aggregation.
      Parameters:
      weightColumn - the column containing the weights
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggWSum

      @JsMethod public static WSum AggWSum(Column.ColumnOrName weightColumn, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a Weighted Sum aggregation.
      Parameters:
      weightColumn - the column containing the weights
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggSortedFirst

      @JsMethod public static SortedFirst AggSortedFirst(elemental2.core.ReadonlyArray<Column.ColumnOrName> sortedColumns, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a SortedFirst aggregation, returning the first value when each group is sorted by the given columns.
      Parameters:
      sortedColumns - the columns to sort by when determining the "first" row
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggSortedLast

      @JsMethod public static SortedLast AggSortedLast(elemental2.core.ReadonlyArray<Column.ColumnOrName> sortedColumns, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a SortedLast aggregation, returning the last value when each group is sorted by the given columns.
      Parameters:
      sortedColumns - the columns to sort by when determining the "last" row
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggTDigest

      @JsMethod public static TDigest AggTDigest(@JsOptional @JsNullable Double compression, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns)
      Creates a T-Digest aggregation, storing the T-Digest data structure for later percentile calculations.
      Parameters:
      compression - T-Digest compression factor, which must be ≥ 1. If null, the server chooses a default.
      columns - the columns to aggregate, which can be renaming expressions such as "Out = In". Defaults to null, which is valid only in aggAllBy where it will be ignored.
      Returns:
      an aggregation
    • AggFormula

      @JsMethod public static Formula AggFormula(String formula)
      Creates a Formula aggregation, computing one output column per group from a formula such as "MaxW = max(W)". See Formula for what the column names in the expression stand for.
      Parameters:
      formula - the output column's name and the expression that computes it, as "Out = expression"
      Returns:
      an aggregation
    • AggCount

      @JsMethod public static Count AggCount(String col)
      Creates a Count aggregation, counting the number of rows in each group. Not supported in aggAllBy.
      Parameters:
      col - the output column name to hold the counts
      Returns:
      an aggregation
    • AggCountWhere

      @JsMethod public static CountWhere AggCountWhere(String col, elemental2.core.ReadonlyArray<String> filters)
      Creates a CountWhere aggregation, counting rows that match the given filter(s) in each group. Not supported in aggAllBy.
      Parameters:
      col - the output column name to hold the counts
      filters - the filter expression(s) to apply before counting
      Returns:
      an aggregation
    • AggPartition

      @JsMethod public static Partition AggPartition(String col, @JsOptional @JsNullable Boolean includeGroupByColumns)
      Creates a Partition aggregation, splitting the table into sub-tables, one per group. Not supported in aggAllBy.
      Parameters:
      col - the output column name to hold the sub-tables
      includeGroupByColumns - whether to include the group-by columns in each sub-table. Defaults to true
      Returns:
      an aggregation
    • AggFirstRowKey

      @JsMethod public static FirstRowKey AggFirstRowKey(String col)
      Creates a FirstRowKey aggregation, returning the row key of the first row in each group. Not supported in aggAllBy.
      Parameters:
      col - the output column name to hold the first row key
      Returns:
      an aggregation
    • AggLastRowKey

      @JsMethod public static LastRowKey AggLastRowKey(String col)
      Creates a LastRowKey aggregation, returning the row key of the last row in each group. Not supported in aggAllBy.
      Parameters:
      col - the output column name to hold the last row key
      Returns:
      an aggregation