java.lang.Object
com.pervasive.datarush.operators.group.Aggregation
A representation of an aggregation on a specific field in a record. To be used with
Group.
Users should only use the #Aggregation(AggregatorFactory, String) constructor for custom-coded aggregation operators.
Otherwise, they should use the static factory methods this class provides, such as #sum(String) and #max(String).
-
Constructor Summary
ConstructorsConstructorDescriptionAggregation(AggregatorFactory aggregatorFactory, ScalarValuedFunction sourceFunction) Constructs anAggregationfor a specified record field using specified arguments.Aggregation(AggregatorFactory aggregatorFactory, String sourceField) Constructs anAggregationfor a specified record field using specified arguments.Aggregation(AggregatorFactory aggregatorFactory, List<ScalarValuedFunction> sourceFunctions) Constructs anAggregationfor a specified record field using specified arguments. -
Method Summary
Modifier and TypeMethodDescriptionCreates an identical aggregation whose output field name will be the specified label.static Aggregationavg(ScalarValuedFunction input) Create an average value aggregation for the given input.static AggregationCreate an average value aggregation for the given input.static Aggregationcorr(ScalarValuedFunction input1, ScalarValuedFunction input2) Create a correlation aggregation for the given inputs.static AggregationCreate a correlation aggregation for the given inputs.static Aggregationcount()Create a count aggregation for all rows within a group.static Aggregationcount(ScalarValuedFunction input) Create a value count aggregation for the given input.static AggregationCreate a value count aggregation for the given input.static Aggregationcovar(ScalarValuedFunction input1, ScalarValuedFunction input2) Create a covariance aggregation for the given inputs.static Aggregationcovar(ScalarValuedFunction input1, ScalarValuedFunction input2, boolean sample) Create a covariance aggregation for the given inputs.static AggregationCreate a covariance aggregation for the given inputs.static AggregationCreate a covariance aggregation for the given inputs.distinct(boolean distinct) Creates an identical aggregation whose distinct flag is set to the specified value.booleanstatic AggregationgeoAvg(ScalarValuedFunction input) Create a geometric average value aggregation for the given input.static AggregationCreate a geometric average value aggregation for the given input.Returns the aggregator factory for this aggregation.Returns the output name for this aggregation.Returns the source functions of this aggregation.static AggregationharmAvg(ScalarValuedFunction input) Create an harmonic average value aggregation for the given input.static AggregationCreate an harmonic average value aggregation for the given input.inthashCode()booleanReturns whether to compute the aggregation based on the distinct values of the given field(s).static Aggregationkurtosis(ScalarValuedFunction input) Create a kurtosis aggregation for the given input.static Aggregationkurtosis(ScalarValuedFunction input, boolean sample) Create a kurtosis aggregation for the given input.static AggregationCreate a kurtosis aggregation for the given input.static AggregationCreate a kurtosis aggregation for the given input.static Aggregationmax(ScalarValuedFunction input) Create a maximum value aggregation for the given input.static AggregationCreate a maximum value aggregation for the given input.static Aggregationmin(ScalarValuedFunction input) Create a minimum value aggregation for the given input.static AggregationCreate a minimum value aggregation for the given input.static Aggregationmoment(ScalarValuedFunction input, int k) Create a central moment aggregation for the given input.static AggregationCreate a central moment aggregation for the given input.static Aggregationskewness(ScalarValuedFunction input) Create a skewness aggregation for the given input.static Aggregationskewness(ScalarValuedFunction input, boolean sample) Create a skewness aggregation for the given input.static AggregationCreate a skewness aggregation for the given input.static AggregationCreate a skewness aggregation for the given input.static Aggregationstddev(ScalarValuedFunction input) Create a standard deviation aggregation for the given input.static Aggregationstddev(ScalarValuedFunction input, boolean sample) Create a standard deviation aggregation for the given input.static AggregationCreate a standard deviation aggregation for the given input.static AggregationCreate a standard deviation aggregation for the given input.static Aggregationsum(ScalarValuedFunction input) Create a value summation aggregation for the given input.static AggregationCreate a value summation aggregation for the given input.static AggregationsumSquares(ScalarValuedFunction input) Create a sum-squares aggregation for the given input.static AggregationsumSquares(String input) Create a sum-squares aggregation for the given input.toString()voidvalidateInputType(RecordTokenType inputType) Validate the input types to this aggregation.static Aggregationvar(ScalarValuedFunction input) Create a variance aggregation for the given input.static Aggregationvar(ScalarValuedFunction input, boolean sample) Create a variance aggregation for the given input.static AggregationCreate a variance aggregation for the given input.static AggregationCreate a variance aggregation for the given input.
-
Constructor Details
-
Aggregation
Constructs anAggregationfor a specified record field using specified arguments.- Parameters:
aggregatorFactory- the factory for constructing the desired aggregatorsourceField- the field to aggregate
-
Aggregation
Constructs anAggregationfor a specified record field using specified arguments.- Parameters:
aggregatorFactory- the factory for constructing the desired aggregatorsourceFunction- the function to aggregate
-
Aggregation
Constructs anAggregationfor a specified record field using specified arguments.- Parameters:
aggregatorFactory- the factory for constructing the desired aggregatorsourceFields- the fields to aggregate
-
-
Method Details
-
as
Creates an identical aggregation whose output field name will be the specified label. This is analogous to theASkeyword in SQL. The supplied name must be unique among all fields in the result or an error will be raised during graph composition.Use this method to explictly specify the name of the result. For example, to sum the prices in the group and label the result "revenue":
Aggegation.sum("salePrice").as("revenue")- Parameters:
label- the name to use for the output field- Returns:
- an aggregation using the specified name for the result field
-
distinct
Creates an identical aggregation whose distinct flag is set to the specified value.- Parameters:
distinct- whether to compute distinct aggregations- Returns:
- an aggregation whose distinct flag is set accordinging
-
isDistinct
public boolean isDistinct()Returns whether to compute the aggregation based on the distinct values of the given field(s).- Returns:
- whether to compute the aggregation based on the distinct values of the given field(s).
-
getSourceFunctions
Returns the source functions of this aggregation.- Returns:
- the source functions of this aggregation.
-
getAggregatorFactory
Returns the aggregator factory for this aggregation.- Returns:
- the aggregator factory for this aggregation.
-
getOutputName
Returns the output name for this aggregation.- Returns:
- the output name for this aggregation.
-
validateInputType
Validate the input types to this aggregation.- Parameters:
inputType- the type of the record used as input to the aggregation- Throws:
DRException- if a subexpression evaluates to a type incompatible with the aggregation or parent function, or if a referenced field is not present in the input type
-
avg
Create an average value aggregation for the given input.- Parameters:
input- input field name- Returns:
- average value aggregation
-
avg
Create an average value aggregation for the given input.- Parameters:
input- input function- Returns:
- average value aggregation
-
count
Create a count aggregation for all rows within a group. Equivalent to the SQL count(*).- Returns:
- a count aggregation for all rows within a group.
-
count
Create a value count aggregation for the given input. This aggregation only counts non-null values.- Parameters:
input- input field name- Returns:
- non-null value count aggregation
-
count
Create a value count aggregation for the given input. This aggregation only counts non-null values.- Parameters:
input- input function- Returns:
- non-null value count aggregation
-
corr
Create a correlation aggregation for the given inputs.- Parameters:
input1- input field nameinput2- input field name- Returns:
- correlation aggregation
-
corr
Create a correlation aggregation for the given inputs.- Parameters:
input1- input functioninput2- input function- Returns:
- correlation aggregation
-
covar
Create a covariance aggregation for the given inputs.- Parameters:
input1- input field nameinput2- input field name- Returns:
- covariance (population) aggregation
-
covar
Create a covariance aggregation for the given inputs.- Parameters:
input1- input field nameinput2- input field namesample- whether to adjust for sampling- Returns:
- covariance aggregation
-
covar
Create a covariance aggregation for the given inputs.- Parameters:
input1- input functioninput2- input function- Returns:
- covariance (population) aggregation
-
covar
public static Aggregation covar(ScalarValuedFunction input1, ScalarValuedFunction input2, boolean sample) Create a covariance aggregation for the given inputs.- Parameters:
input1- input functioninput2- input functionsample- whether to adjust for sampling- Returns:
- covariance aggregation
-
geoAvg
Create a geometric average value aggregation for the given input.- Parameters:
input- input field name- Returns:
- geometric average value aggregation
-
geoAvg
Create a geometric average value aggregation for the given input.- Parameters:
input- input function- Returns:
- geometric average value aggregation
-
harmAvg
Create an harmonic average value aggregation for the given input.- Parameters:
input- input field name- Returns:
- harmonic average value aggregation
-
harmAvg
Create an harmonic average value aggregation for the given input.- Parameters:
input- input function- Returns:
- harmonic average value aggregation
-
kurtosis
Create a kurtosis aggregation for the given input.- Parameters:
input- input field name- Returns:
- kurtosis (population) aggregation
-
kurtosis
Create a kurtosis aggregation for the given input.- Parameters:
input- input field namesample- whether to adjust for sampling- Returns:
- kurtosis aggregation
-
kurtosis
Create a kurtosis aggregation for the given input.- Parameters:
input- input function- Returns:
- kurtosis (population) aggregation
-
kurtosis
Create a kurtosis aggregation for the given input.- Parameters:
input- input functionsample- whether to adjust for sampling- Returns:
- kurtosis aggregation
-
max
Create a maximum value aggregation for the given input.- Parameters:
input- input field name- Returns:
- maximum value aggregation
-
max
Create a maximum value aggregation for the given input.- Parameters:
input- input field name- Returns:
- maximum value aggregation
-
min
Create a minimum value aggregation for the given input.- Parameters:
input- input field name- Returns:
- minimum value aggregation
-
min
Create a minimum value aggregation for the given input.- Parameters:
input- input function- Returns:
- minimum value aggregation
-
moment
Create a central moment aggregation for the given input.- Parameters:
input- input field namek- the moment to calculate.- Returns:
- central moment aggregation
-
moment
Create a central moment aggregation for the given input.- Parameters:
input- input field namek- the moment to calculate.- Returns:
- central moment aggregation
-
skewness
Create a skewness aggregation for the given input.- Parameters:
input- input field name- Returns:
- skewness (population) aggregation
-
skewness
Create a skewness aggregation for the given input.- Parameters:
input- input field namesample- whether to adjust for sampling- Returns:
- skewness aggregation
-
skewness
Create a skewness aggregation for the given input.- Parameters:
input- input function- Returns:
- skewness (population) aggregation
-
skewness
Create a skewness aggregation for the given input.- Parameters:
input- input functionsample- whether to adjust for sampling- Returns:
- skewness aggregation
-
stddev
Create a standard deviation aggregation for the given input.- Parameters:
input- input field name- Returns:
- standard deviation (population) aggregation
-
stddev
Create a standard deviation aggregation for the given input.- Parameters:
input- input field namesample- whether to adjust for sampling- Returns:
- standard deviation aggregation
-
stddev
Create a standard deviation aggregation for the given input.- Parameters:
input- input function- Returns:
- standard deviation (population) aggregation
-
stddev
Create a standard deviation aggregation for the given input.- Parameters:
input- input functionsample- whether to adjust for sampling- Returns:
- standard deviation aggregation
-
sum
Create a value summation aggregation for the given input.- Parameters:
input- input field name- Returns:
- summation aggregation type
-
sum
Create a value summation aggregation for the given input.- Parameters:
input- input field name- Returns:
- summation aggregation type
-
sumSquares
Create a sum-squares aggregation for the given input.- Parameters:
input- input field name- Returns:
- summation aggregation type
-
sumSquares
Create a sum-squares aggregation for the given input.- Parameters:
input- input function- Returns:
- summation aggregation type
-
var
Create a variance aggregation for the given input.- Parameters:
input- input field name- Returns:
- variance (population) aggregation
-
var
Create a variance aggregation for the given input.- Parameters:
input- input field namesample- whether to adjust for sampling- Returns:
- variance (sample) aggregation
-
var
Create a variance aggregation for the given input.- Parameters:
input- input function- Returns:
- variance (population) aggregation
-
var
Create a variance aggregation for the given input.- Parameters:
input- input functionsample- whether to adjust for sampling- Returns:
- variance (sample) aggregation
-
toString
-
equals
-
hashCode
public int hashCode()
-