Class ComboAggregateFactory
- All Implemented Interfaces:
AggregationStateFactory,Serializable
Table.by(AggregationStateFactory).
The intended use of this class is to call the AggCombo(ComboBy...) method with a set of aggregations
defined by:
AggMin(java.lang.String...)AggMax(java.lang.String...)AggSum(java.lang.String...)AggAbsSum(java.lang.String...)AggVar(java.lang.String...)AggAvg(java.lang.String...)AggWAvg(java.lang.String, java.lang.String...)AggWSum(java.lang.String, java.lang.String...)AggMed(java.lang.String...)AggPct(double, java.lang.String...)AggStd(java.lang.String...)AggFirst(java.lang.String...)AggLast(java.lang.String...)AggCount(java.lang.String)AggCountDistinct(java.lang.String...)AggDistinct(java.lang.String...)AggArray(java.lang.String...)AggSortedFirst(java.lang.String, java.lang.String...)AggSortedLast(java.lang.String, java.lang.String...)
For example, to produce a table with several aggregations on the LastPrice of a Trades table:
ohlc=trades.by(AggCombo(AggFirst("Open=LastPrice"), AggLast("Close=LastPrice"), AggMax("High=LastPrice"), AggMin("Low=LastPrice"), AggSum("Volume=Size"), AggWAvg("Size", "VWAP=LastPrice"), "Symbol")
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionComboAggregateFactory(ComboAggregateFactory.ComboBy... aggregations) ComboAggregateFactory(Collection<ComboAggregateFactory.ComboBy> aggregations) ComboAggregateFactory(Collection<ComboAggregateFactory.ComboBy> aggregations, boolean isRollup, boolean secondLevelRollup, boolean includesConstituents) -
Method Summary
Modifier and TypeMethodDescriptionAgg(AggregationStateFactory factory, String... matchPairs) Create an aggregation.Create an aggregation.Create an absolute sum aggregation, equivalent toTable.absSumBy(String...).Create an array aggregation, equivalent toTable.by(String...).Create an average aggregation, equivalent toTable.avgBy(String...).static ComboAggregateFactoryAggCombo(ComboAggregateFactory.ComboBy... aggregations) Create a new ComboAggregateFactory suitable for passing toTable.by(AggregationStateFactory, String...).Create an count aggregation, equivalent toTable.countBy(String).AggCountDistinct(boolean countNulls, String... matchPairs) Create a distinct count aggregation.AggCountDistinct(String... matchPairs) Create a distinct count aggregation.AggDistinct(boolean countNulls, String... matchPairs) Create a distinct aggregation.AggDistinct(String... matchPairs) Create a distinct aggregation.Create a first aggregation, equivalent toTable.firstBy(String...).AggFormula(String formula, String formulaParam, String... matchPairs) Create a formula aggregation.Create a last aggregation, equivalent toTable.lastBy(String...).Create a maximum aggregation, equivalent toTable.maxBy(String...).Create a median aggregation, equivalent toTable.medianBy(String...).Create a minimum aggregation, equivalent toTable.minBy(String...).Create a percentile aggregation.Create a percentile aggregation.AggSortedFirst(String[] sortColumns, String... matchPairs) Create a sorted first aggregation, equivalent toSortedBy.sortedFirstBy(com.illumon.iris.db.tables.Table, java.lang.String).AggSortedFirst(String sortColumn, String... matchPairs) Create a sorted first aggregation, equivalent toSortedBy.sortedFirstBy(com.illumon.iris.db.tables.Table, java.lang.String).AggSortedLast(String[] sortColumns, String... matchPairs) Create a sorted last aggregation, equivalent toSortedBy.sortedLastBy(com.illumon.iris.db.tables.Table, java.lang.String).AggSortedLast(String sortColumn, String... matchPairs) Create a sorted last aggregation, equivalent toSortedBy.sortedLastBy(com.illumon.iris.db.tables.Table, java.lang.String).Create a standard deviation aggregation, equivalent toTable.stdBy(String...).Create a summation aggregation, equivalent toTable.sumBy(String...).Create a Unique aggregation.Create a Unique aggregation.Create a Unique aggregation.Create a variance aggregation, equivalent toTable.varBy(String...).Create a weighted average aggregation, equivalent toTable.wavgBy(String, String...).Create a weighted sum aggregation, equivalent toTable.wsumBy(String, String...).forRollup(boolean includeConstituents) Produces a MemoKey for this aggregation state factory.booleanbooleanisRollup()Create a factory for performing rollups.toString()Create a new factory that will have columns with all null values.
-
Field Details
-
ROLLUP_DISTINCT_SSM_COLUMN_ID
- See Also:
-
ROLLUP_COLUMN_SUFFIX
- See Also:
-
-
Constructor Details
-
ComboAggregateFactory
-
ComboAggregateFactory
public ComboAggregateFactory(Collection<ComboAggregateFactory.ComboBy> aggregations, boolean isRollup, boolean secondLevelRollup, boolean includesConstituents) -
ComboAggregateFactory
-
-
Method Details
-
AggCombo
Create a new ComboAggregateFactory suitable for passing toTable.by(AggregationStateFactory, String...).- Parameters:
aggregations- the aggregations to compute- Returns:
- a new table with the specified aggregations.
-
AggFormula
public static ComboAggregateFactory.ComboBy AggFormula(String formula, String formulaParam, String... matchPairs) Create a formula aggregation.- Parameters:
formula- the formula to apply to each groupformulaParam- the parameter name within the formulamatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggMin
Create a minimum aggregation, equivalent toTable.minBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggMax
Create a maximum aggregation, equivalent toTable.maxBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggSum
Create a summation aggregation, equivalent toTable.sumBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggAbsSum
Create an absolute sum aggregation, equivalent toTable.absSumBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggVar
Create a variance aggregation, equivalent toTable.varBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggAvg
Create an average aggregation, equivalent toTable.avgBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggWAvg
Create a weighted average aggregation, equivalent toTable.wavgBy(String, String...).- Parameters:
weight- the name of the column to use as the weight for the averagematchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggWSum
Create a weighted sum aggregation, equivalent toTable.wsumBy(String, String...).- Parameters:
weight- the name of the column to use as the weight for the summatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggMed
Create a median aggregation, equivalent toTable.medianBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggStd
Create a standard deviation aggregation, equivalent toTable.stdBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggFirst
Create a first aggregation, equivalent toTable.firstBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggLast
Create a last aggregation, equivalent toTable.lastBy(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggSortedFirst
Create a sorted first aggregation, equivalent toSortedBy.sortedFirstBy(com.illumon.iris.db.tables.Table, java.lang.String).- Parameters:
sortColumn- the column to sort bymatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggSortedLast
Create a sorted last aggregation, equivalent toSortedBy.sortedLastBy(com.illumon.iris.db.tables.Table, java.lang.String).- Parameters:
sortColumn- the column to sort bymatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggSortedFirst
public static ComboAggregateFactory.ComboBy AggSortedFirst(String[] sortColumns, String... matchPairs) Create a sorted first aggregation, equivalent toSortedBy.sortedFirstBy(com.illumon.iris.db.tables.Table, java.lang.String).- Parameters:
sortColumns- the column to sort bymatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggSortedLast
public static ComboAggregateFactory.ComboBy AggSortedLast(String[] sortColumns, String... matchPairs) Create a sorted last aggregation, equivalent toSortedBy.sortedLastBy(com.illumon.iris.db.tables.Table, java.lang.String).- Parameters:
sortColumns- the columns to sort bymatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggArray
Create an array aggregation, equivalent toTable.by(String...).- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggCount
Create an count aggregation, equivalent toTable.countBy(String).- Parameters:
resultColumn- the name of the result column containing the count of each group- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggCountDistinct
Create a distinct count aggregation. The output column contains the number of distinct values for the input column in that group.- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...). Null values are not counted.
-
AggCountDistinct
public static ComboAggregateFactory.ComboBy AggCountDistinct(boolean countNulls, String... matchPairs) Create a distinct count aggregation. The output column contains the number of distinct values for the input column in that group.- Parameters:
countNulls- if true null values are counted as a distinct value, otherwise null values are ignoredmatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggDistinct
Create a distinct aggregation. The output column contains aDbArrayBasewith the distinct values for the input column within the group.- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...). Null values are ignored.
-
AggDistinct
Create a distinct aggregation. The output column contains aDbArrayBasewith the distinct values for the input column within the group.- Parameters:
countNulls- if true, then null values are included in the result, otherwise null values are ignoredmatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggUnique
Create a Unique aggregation. The output column contains a value of the same type as the input column which contains
- The "no key value" - if there are no values present
- The single unique value - if there is only a single value present
- The "non unique value" - if there are more than 1 distinct values present
- Parameters:
matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggUnique
Create a Unique aggregation. The output column contains a value of the same type as the input column which contains
- The "no key value" - if there are no values present
- The single unique value - if there is only a single value present
- The "non unique value" - if there are more than 1 distinct values present
- Parameters:
countNulls- if true, then null values are included in the result, otherwise null values are ignoredmatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...). Output columns contain null if there are no values present or there are more than 1 distinct values present.
-
AggUnique
public static ComboAggregateFactory.ComboBy AggUnique(boolean countNulls, Object noKeyValue, Object nonUniqueValue, String... matchPairs) Create a Unique aggregation. The output column contains a value of the same type as the input column which contains
- The "no key value" - if there are no values present
- The single unique value - if there is only a single value present
- The "non unique value" - if there are more than 1 distinct values present
- Parameters:
countNulls- if true, then null values are included in the result, otherwise null values are ignorednoKeyValue- the value to use if there are no values presentnonUniqueValue- the value to use if there are more than 1 values presentmatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggPct
Create a percentile aggregation.- Parameters:
percentile- the percentile to calculatematchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
AggPct
public static ComboAggregateFactory.ComboBy AggPct(double percentile, boolean averageMedian, String... matchPairs) Create a percentile aggregation.- Parameters:
percentile- the percentile to calculateaverageMedian- if true, then when the upper values and lower values have an equal size; average the highest lower value and lowest upper value to produce the median value for integers, longs, doubles, and floatsmatchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
Agg
public static ComboAggregateFactory.ComboBy Agg(AggregationStateFactory factory, String... matchPairs) Create an aggregation.- Parameters:
factory- aggregation factory.matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
Agg
Create an aggregation.- Parameters:
factoryType- aggregation factory type.matchPairs- the columns to apply the aggregation to in the form Output=Input, if the Output and Input have the same name, then the column name can be specified.- Returns:
- a ComboBy object suitable for passing to
AggCombo(ComboBy...)
-
rollupFactory
Create a factory for performing rollups. -
forRollup
-
withNulls
Create a new factory that will have columns with all null values. Used by rollup to empty out unused grouping columns.- Parameters:
nullColumns- a map of column names to types.- Returns:
- a new ComboAggregateFactory that will produce null values for the given columns.
-
getMemoKey
Description copied from interface:AggregationStateFactoryProduces a MemoKey for this aggregation state factory.If two AggregationStateFactories have equal memoKeys, then
Table.by(com.illumon.iris.db.v2.by.AggregationStateFactory, com.illumon.iris.db.v2.select.SelectColumn...)operations that have the same group by columns may be memoized. In that case instead of recomputing the result; the original result will be used.If null is returned, the operation will not be memoized.
- Specified by:
getMemoKeyin interfaceAggregationStateFactory- Returns:
- an AggregationMemoKey, null if this operation can not be memoized.
-
toString
-
getMatchPairs
-
makeAggregationContextFactory
-
isRollup
public boolean isRollup() -
isIncludesConstituents
public boolean isIncludesConstituents()
-