Package io.deephaven.web.client.api.agg
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AbsSumAggAbsSum(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates an absolute-sum aggregation.static ApproxPercentileAggApproxPct(double percentile, @JsNullable Double compression, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates an Approximate Percentile aggregation using T-Digest.static AvgAggAvg(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates an Average (arithmetic mean) aggregation.static CountCreates a Count aggregation, counting the number of rows in each group.static CountDistinctAggCountDistinct(@JsNullable Boolean countNulls, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Count Distinct aggregation, counting the number of distinct values in each group.static CountWhereAggCountWhere(String col, elemental2.core.ReadonlyArray<String> filters) Creates a CountWhere aggregation, counting rows that match the given filter(s) in each group.static DistinctAggDistinct(@JsNullable Boolean includeNulls, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Distinct aggregation, collecting the distinct values within each group as arrays.static FirstAggFirst(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a First aggregation, returning the first value in each group.static FirstRowKeyAggFirstRowKey(String col) Creates a FirstRowKey aggregation, returning the row key of the first row in each group.static FormulaAggFormula(String formula) Creates a Formula aggregation, computing one output column per group from a formula such as"MaxW = max(W)".static FreezeAggFreeze(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Freeze aggregation, which keeps the first value seen and ignores subsequent changes.static GroupAggGroup(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Group aggregation, collecting values into arrays.static LastAggLast(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Last aggregation, returning the last value in each group.static LastRowKeyAggLastRowKey(String col) Creates a LastRowKey aggregation, returning the row key of the last row in each group.static MaxAggMax(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Max aggregation.static MedianAggMed(@JsNullable Boolean averageEvenlyDivided, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Median aggregation.static MinAggMin(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Min aggregation.static PartitionAggPartition(String col, @JsNullable Boolean includeGroupByColumns) Creates a Partition aggregation, splitting the table into sub-tables, one per group.static PercentileAggPct(double percentile, @JsNullable Boolean averageEvenlyDivided, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Percentile aggregation.static SortedFirstAggSortedFirst(elemental2.core.ReadonlyArray<Column.ColumnOrName> sortedColumns, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a SortedFirst aggregation, returning the first value when each group is sorted by the given columns.static SortedLastAggSortedLast(elemental2.core.ReadonlyArray<Column.ColumnOrName> sortedColumns, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a SortedLast aggregation, returning the last value when each group is sorted by the given columns.static StdAggStd(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Std (sample standard deviation) aggregation, computed using Bessel's correction.static SumAggSum(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Sum aggregation.static TDigestAggTDigest(@JsNullable Double compression, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a T-Digest aggregation, storing the T-Digest data structure for later percentile calculations.static UniqueAggUnique(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns, @JsNullable Boolean includeNulls, @JsNullable Unique.NonUniqueSentinelUnion nonUniqueSentinel) Creates a Unique aggregation, returning the single unique value within each group.static VarAggVar(@JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Var (sample variance) aggregation, computed using Bessel's correction.static WAvgAggWAvg(Column.ColumnOrName weightColumn, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Weighted Average aggregation.static WSumAggWSum(Column.ColumnOrName weightColumn, @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columns) Creates a Weighted Sum aggregation.
-
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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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 tonull, which is valid only inaggAllBywhere 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. Whentrue, averages the two middle values. Whenfalse, uses the larger value. Onlyint,long,floatanddoublecolumns are averaged. Defaults totrue.columns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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. Onlyint,long,floatanddoublecolumns are averaged. Defaults tofalseif not specifiedcolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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. Ifnull, the server chooses a default.columns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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 valuescolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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 tofalse.columns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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 isnonUniqueSentinel.- Parameters:
columns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere it will be ignored.includeNulls- whether null is treated as a value for determining uniqueness. Defaults tofalse.nonUniqueSentinel- the value for a group with more than one distinct value. Defaults tonull.- 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 weightscolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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 weightscolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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" rowcolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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" rowcolumns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere 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. Ifnull, the server chooses a default.columns- the columns to aggregate, which can be renaming expressions such as"Out = In". Defaults tonull, which is valid only inaggAllBywhere it will be ignored.- Returns:
- an aggregation
-
AggFormula
Creates a Formula aggregation, computing one output column per group from a formula such as"MaxW = max(W)". SeeFormulafor 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
Creates a Count aggregation, counting the number of rows in each group. Not supported inaggAllBy.- 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 inaggAllBy.- Parameters:
col- the output column name to hold the countsfilters- 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 inaggAllBy.- Parameters:
col- the output column name to hold the sub-tablesincludeGroupByColumns- whether to include the group-by columns in each sub-table. Defaults totrue- Returns:
- an aggregation
-
AggFirstRowKey
Creates a FirstRowKey aggregation, returning the row key of the first row in each group. Not supported inaggAllBy.- Parameters:
col- the output column name to hold the first row key- Returns:
- an aggregation
-
AggLastRowKey
Creates a LastRowKey aggregation, returning the row key of the last row in each group. Not supported inaggAllBy.- Parameters:
col- the output column name to hold the last row key- Returns:
- an aggregation
-