Package io.deephaven.api.agg
Interface Aggregation
- All Known Subinterfaces:
RollupAggregation
- All Known Implementing Classes:
Aggregations
,ColumnAggregation
,ColumnAggregations
,Count
,FirstRowKey
,Formula
,LastRowKey
,NullColumns
,Partition
,RollupAggregationBase
public interface Aggregation
Represents an aggregation that can be applied to a table.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Aggregation
Create anabsolute sum
aggregation for the supplied column name pairs.static Aggregation
AggApproxPct
(double percentile, double compression, String... pairs) Create anapproximate percentile
aggregation for the supplied percentile, T-Digest compression factor, and column name pairs.static Aggregation
AggApproxPct
(double percentile, String... pairs) Create anapproximate percentile
aggregation for the supplied percentile and column name pairs with the default T-Digestcompression
factor.static Aggregation
AggApproxPct
(String inputColumn, double compression, PercentileOutput... percentileOutputs) Create anapproximate percentile
aggregation for the supplied input column name, T-Digest compression factor, and percentile/output column name pairs.static Aggregation
AggApproxPct
(String inputColumn, PercentileOutput... percentileOutputs) Create anapproximate percentile
aggregation for the supplied input column name and percentile/output column name pairs with the default T-Digestcompression
factor.static Aggregation
Create anaverage
(arithmetic mean) aggregation for the supplied column name pairs.static Count
Create acount
aggregation with the supplied output column name.static Aggregation
AggCountDistinct
(boolean countNulls, String... pairs) Create acount distinct
aggregation for the supplied column name pairs.static Aggregation
AggCountDistinct
(String... pairs) Create acount distinct
aggregation for the supplied column name pairs.static Aggregation
AggDistinct
(boolean includeNulls, String... pairs) Create adistinct
aggregation for the supplied column name pairs.static Aggregation
AggDistinct
(String... pairs) Create adistinct
aggregation for the supplied column name pairs.static Aggregation
Create afirst
aggregation for the supplied column name pairs.static FirstRowKey
AggFirstRowKey
(String resultColumn) Create afirst row key
aggregation with the supplied result column.static Formula
AggFormula
(String formulaString) Create aformula
aggregation with the suppliedformula
.static Formula
AggFormula
(String columnName, String expression) static Aggregation
AggFormula
(String formula, String paramToken, String... pairs) Deprecated.static Aggregation
Create afreeze
aggregation for the supplied column name pairs.static Aggregation
Create agroup
aggregation for the supplied column name pairs.static Aggregation
Create alast
aggregation for the supplied column name pairs.static LastRowKey
AggLastRowKey
(String resultColumn) Create alast row key
aggregation with the supplied result column.static Aggregation
Create amax
aggregation for the supplied column name pairs.static Aggregation
Create amedian
aggregation for the supplied column name pairs.static Aggregation
Create amedian
aggregation for the supplied column name pairs.static Aggregation
Create amin
aggregation for the supplied column name pairs.static Partition
AggPartition
(String resultColumn) Create apartition
aggregation with the supplied output column name and group-by columns included in the output sub-tables.static Partition
AggPartition
(String resultColumn, boolean includeGroupByColumns) Create apartition
aggregation with the supplied output column name.static Aggregation
Create apercentile
aggregation for the supplied percentile and column name pairs.static Aggregation
Create apercentile
aggregation for the supplied percentile and column name pairs.static Aggregation
AggPct
(String inputColumn, boolean average, PercentileOutput... percentileOutputs) Create apercentile
aggregation for the supplied input column name and percentile/output column name pairs.static Aggregation
AggPct
(String inputColumn, PercentileOutput... percentileOutputs) Create apercentile
aggregation for the supplied input column name and percentile/output column name pairs.static Aggregation
AggSortedFirst
(String sortColumn, String... pairs) Create asorted first
aggregation for the supplied sort column name and input/output column name pairs.static Aggregation
AggSortedFirst
(Collection<? extends String> sortColumns, String... pairs) Create asorted first
aggregation for the supplied sort column names and input/output column name pairs.static Aggregation
AggSortedLast
(String sortColumn, String... pairs) Create asorted last
aggregation for the supplied sort column name and input/output column name pairs.static Aggregation
AggSortedLast
(Collection<? extends String> sortColumns, String... pairs) Create asorted last
aggregation for the supplied sort column names and input/output column name pairs.static Aggregation
Create asample standard deviation
aggregation for the supplied column name pairs.static Aggregation
Create asum
aggregation for the supplied column name pairs.static Aggregation
AggTDigest
(double compression, String... pairs) Create aT-Digest
aggregation for the supplied column name pairs with the suppliedcompression
factor.static Aggregation
AggTDigest
(String... pairs) Create aT-Digest
aggregation for the supplied column name pairs with the default T-Digestcompression
factor.static Aggregation
AggUnique
(boolean includeNulls, UnionObject nonUniqueSentinel, String... pairs) Create aunique
aggregation for the supplied column name pairs.static Aggregation
Create aunique
aggregation for the supplied column name pairs.static Aggregation
Create aunique
aggregation for the supplied column name pairs.static Aggregation
Create asample variance
aggregation for the supplied column name pairs.static Aggregation
Create aweighted average
aggregation for the supplied weight column name and column name pairs.static Aggregation
Create aweighted sum
aggregation for the supplied weight column name and column name pairs.static Aggregation
of
(Aggregation... aggregations) Pass through a singleAggregation
, or combine many into anAggregations
.static ColumnAggregation
static Aggregation
Combine anAggSpec
and one or more input/outputcolumn name pairs
into aColumnAggregation
orColumnAggregations
.static Aggregation
Combine anAggSpec
and one or more input/outputcolumn name pairs
into aColumnAggregation
orColumnAggregations
.static <INPUT_TYPE>
Aggregationof
(BiFunction<ColumnName, INPUT_TYPE, ColumnAggregation> columnAggFactory, String inputColumn, INPUT_TYPE... inputs) Create a single or compoundAggregation
from a single input column and one or more per-aggregation input values.static PercentileOutput
static void
visitAll
(Aggregation.Visitor visitor) Calls every single visit method ofvisitor
with anull
object.<V extends Aggregation.Visitor>
Vwalk
(V visitor) Glue method to deliver this Aggregation to aAggSpec.Visitor
.
-
Method Details
-
of
- Parameters:
spec
- Theaggregation specifier
to apply to the column name pairpair
- Theinput/output column name pair
- Returns:
- The aggregation
-
of
Combine anAggSpec
and one or more input/outputcolumn name pairs
into aColumnAggregation
orColumnAggregations
.- Parameters:
spec
- Theaggregation specifier
to apply to the column name pair(s)pairs
- The input/output column namepair
orpairs
- Returns:
- The aggregation
-
of
Combine anAggSpec
and one or more input/outputcolumn name pairs
into aColumnAggregation
orColumnAggregations
.- Parameters:
spec
- Theaggregation specifier
to apply to the column name pair(s)pairs
- The input/output column namepair
orpairs
- Returns:
- The aggregation
-
of
Pass through a singleAggregation
, or combine many into anAggregations
.- Parameters:
aggregations
- Theaggregations
to combine- Returns:
- The combined aggregation
-
of
@SafeVarargs static <INPUT_TYPE> Aggregation of(BiFunction<ColumnName, INPUT_TYPE, ColumnAggregation> columnAggFactory, String inputColumn, INPUT_TYPE... inputs) Create a single or compoundAggregation
from a single input column and one or more per-aggregation input values.- Parameters:
columnAggFactory
- A factory for combining an input column and input value into aaggregation
inputColumn
- The input column for each component of the resulting aggregationinputs
- The input values to combine with the input column via the factory- Returns:
- The combined aggregation
-
AggAbsSum
Create anabsolute sum
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggApproxPct
Create anapproximate percentile
aggregation for the supplied percentile and column name pairs with the default T-Digestcompression
factor.- Parameters:
percentile
- Thepercentile
to use for all component aggregationspairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggApproxPct
Create anapproximate percentile
aggregation for the supplied percentile, T-Digest compression factor, and column name pairs.- Parameters:
percentile
- Thepercentile
to use for all component aggregationscompression
- T-Digestcompression
factor; must be > 1, should probably be < 1000pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggApproxPct
Create anapproximate percentile
aggregation for the supplied input column name and percentile/output column name pairs with the default T-Digestcompression
factor.- Parameters:
inputColumn
- The input column namepercentileOutputs
- Thepercentile/output column name pairs
for the component aggregations; seePctOut(double, String)
.- Returns:
- The aggregation
-
AggApproxPct
static Aggregation AggApproxPct(String inputColumn, double compression, PercentileOutput... percentileOutputs) Create anapproximate percentile
aggregation for the supplied input column name, T-Digest compression factor, and percentile/output column name pairs.- Parameters:
inputColumn
- The input column namecompression
- T-Digestcompression
factor; must be > 1, should probably be < 1000percentileOutputs
- Thepercentile/output column name pairs
for the component aggregations; seePctOut(double, String)
.- Returns:
- The aggregation
-
AggAvg
Create anaverage
(arithmetic mean) aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggCount
Create acount
aggregation with the supplied output column name.- Parameters:
resultColumn
- Theoutput column
name- Returns:
- The aggregation
-
AggCountDistinct
Create acount distinct
aggregation for the supplied column name pairs. This will not countnull
values from the input column(s).- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggCountDistinct
Create acount distinct
aggregation for the supplied column name pairs. This will countnull
values from the input column(s) ifcountNulls
istrue
.- Parameters:
countNulls
- Whethernull
values should be counted; seeAggSpecCountDistinct.countNulls()
}pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggDistinct
Create adistinct
aggregation for the supplied column name pairs. This will not includenull
values in the output column(s).- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggDistinct
Create adistinct
aggregation for the supplied column name pairs. This will includenull
values in the output column(s) ifincludeNulls
istrue
.- Parameters:
includeNulls
- Whethernull
values should be included; seeAggSpecDistinct.includeNulls()
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggFirst
Create afirst
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggFirstRowKey
Create afirst row key
aggregation with the supplied result column.- Parameters:
resultColumn
- Theoutput column
name- Returns:
- The aggregation
-
AggFormula
Create a
formula
aggregation with the suppliedformula
. This variant requires the formula to provide the output column name and specific input column names in the following format:AggFormula("output_col=(input_col1 + input_col2) * input_col3")
- Parameters:
formulaString
- The formula to use to produce the output column- Returns:
- The aggregation
-
AggFormula
Create a
formula
aggregation with the suppliedcolumnName
andexpression
. This variant requires the formula to provide the output column name and the expression to evaluate in the following format:AggFormula("output_col", "(input_col1 + input_col2) * input_col3")
- Parameters:
columnName
- The output column nameexpression
- The expression to use to produce the output column- Returns:
- The aggregation
-
AggFormula
Deprecated.- Parameters:
formula
- Theformula
to use for all input columns to produce all output columnsparamToken
- Theparameter token
to replace with the input column name informula
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggFreeze
Create afreeze
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggGroup
Create agroup
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggLast
Create alast
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggLastRowKey
Create alast row key
aggregation with the supplied result column.- Parameters:
resultColumn
- Theoutput column
name- Returns:
- The aggregation
-
AggMax
Create amax
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggMed
Create amedian
aggregation for the supplied column name pairs. For numeric types, if there are an even number of values the result will be an average of the two middle values.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggMed
Create amedian
aggregation for the supplied column name pairs. For numeric types, if there are an even number of values the result will be an average of the two middle values ifaverage
istrue
, else the result will be the lower of the two middle values.- Parameters:
average
- Whether to average the middle two values for even-sized result sets of numeric types; seeAggSpecMedian.averageEvenlyDivided()
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggMin
Create amin
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggPartition
Create apartition
aggregation with the supplied output column name and group-by columns included in the output sub-tables.- Parameters:
resultColumn
- Theoutput column
name- Returns:
- The aggregation
-
AggPartition
Create apartition
aggregation with the supplied output column name.- Parameters:
resultColumn
- Theoutput column
nameincludeGroupByColumns
- Whether to include group-by columns in the result- Returns:
- The aggregation
-
AggPct
Create apercentile
aggregation for the supplied percentile and column name pairs.- Parameters:
percentile
- Thepercentile
to use for all component aggregationspairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggPct
Create apercentile
aggregation for the supplied percentile and column name pairs. If the percentile equally divides the value space, the result will be the average of the values immediately below and above ifaverage
istrue
.- Parameters:
percentile
- Thepercentile
to use for all component aggregationsaverage
- Whether to average the lower and higher values for evenly divided result sets of numeric types; seeAggSpecPercentile.averageEvenlyDivided()
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggPct
Create apercentile
aggregation for the supplied input column name and percentile/output column name pairs.- Parameters:
inputColumn
- The input column namepercentileOutputs
- Thepercentile/output column name pairs
for the component aggregations; seePctOut(double, String)
.- Returns:
- The aggregation
-
AggPct
static Aggregation AggPct(String inputColumn, boolean average, PercentileOutput... percentileOutputs) Create apercentile
aggregation for the supplied input column name and percentile/output column name pairs. If the percentile equally divides the value space, the result will be the average of the values immediately below and above ifaverage
istrue
.- Parameters:
inputColumn
- The input column nameaverage
- Whether to average the lower and higher values for evenly divided result sets of numeric types; seeAggSpecPercentile.averageEvenlyDivided()
percentileOutputs
- Thepercentile/output column name pairs
for the component aggregations; seePctOut(double, String)
.- Returns:
- The aggregation
-
AggSortedFirst
Create asorted first
aggregation for the supplied sort column name and input/output column name pairs.- Parameters:
sortColumn
- The sort column namepairs
- The input/output column name pairs for the component aggregations- Returns:
- The aggregation
-
AggSortedFirst
Create asorted first
aggregation for the supplied sort column names and input/output column name pairs.- Parameters:
sortColumns
- The sort column namespairs
- The input/output column name pairs for the component aggregations- Returns:
- The aggregation
-
AggSortedLast
Create asorted last
aggregation for the supplied sort column name and input/output column name pairs.- Parameters:
sortColumn
- The sort column namepairs
- The input/output column name pairs for the component aggregations- Returns:
- The aggregation
-
AggSortedLast
Create asorted last
aggregation for the supplied sort column names and input/output column name pairs.- Parameters:
sortColumns
- The sort column namespairs
- The input/output column name pairs for the component aggregations- Returns:
- The aggregation
-
AggStd
Create asample standard deviation
aggregation for the supplied column name pairs. Sample standard deviation is computed using Bessel's correction (https://en.wikipedia.org/wiki/Bessel%27s_correction), which ensures that the sample variance will be an unbiased estimator of population variance.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggSum
Create asum
aggregation for the supplied column name pairs.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggTDigest
Create aT-Digest
aggregation for the supplied column name pairs with the default T-Digestcompression
factor.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggTDigest
Create aT-Digest
aggregation for the supplied column name pairs with the suppliedcompression
factor.- Parameters:
compression
- T-Digestcompression
factor; must be > 1, should probably be < 1000pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggUnique
Create aunique
aggregation for the supplied column name pairs. This will not considernull
values when determining if a group has a single unique value. Non-unique groups will havenull
values in the output column.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggUnique
Create aunique
aggregation for the supplied column name pairs. This will considernull
values when determining if a group has a single unique value ifincludeNulls
istrue
. Non-unique groups will havenull
values in the output column.- Parameters:
includeNulls
- Whether to considernull
values towards uniqueness; seeAggSpecUnique.includeNulls()
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggUnique
Create aunique
aggregation for the supplied column name pairs. This will considernull
values when determining if a group has a single unique value ifincludeNulls
istrue
. Non-unique groups will have the value wrapped bynonUniqueSentinel
in the output column.- Parameters:
includeNulls
- Whether to considernull
values towards uniquenessnonUniqueSentinel
- The value to output for non-unique groupspairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggVar
Create asample variance
aggregation for the supplied column name pairs. Sample variance is computed using Bessel's correction (https://en.wikipedia.org/wiki/Bessel%27s_correction), which ensures that the sample variance will be an unbiased estimator of population variance.- Parameters:
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggWAvg
Create aweighted average
aggregation for the supplied weight column name and column name pairs.- Parameters:
weightColumn
- Theweight column name
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
AggWSum
Create aweighted sum
aggregation for the supplied weight column name and column name pairs.- Parameters:
weightColumn
- Theweight column name
pairs
- The input/output column name pairs- Returns:
- The aggregation
-
PctOut
Make apercentile/output column name pair
. This allows for strongly-typed input to various approximate percentile and percentile aggregation factory methods.- Parameters:
percentile
- The percentile for the aggregationoutputColumn
- The output column name to associate with the percentile- Returns:
- The percentile/output column name pair
- See Also:
-
visitAll
Calls every single visit method ofvisitor
with anull
object.- Parameters:
visitor
- the visitor
-
walk
Glue method to deliver this Aggregation to aAggSpec.Visitor
.- Parameters:
visitor
- The visitor- Returns:
- The visitor
-