public final class Aggregation extends Object
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 and Description |
---|
Aggregation(AggregatorFactory aggregatorFactory,
List<ScalarValuedFunction> sourceFunctions)
Constructs an
Aggregation for a specified record field using specified arguments. |
Aggregation(AggregatorFactory aggregatorFactory,
ScalarValuedFunction sourceFunction)
Constructs an
Aggregation for a specified record field using specified arguments. |
Aggregation(AggregatorFactory aggregatorFactory,
String sourceField)
Constructs an
Aggregation for a specified record field using specified arguments. |
Modifier and Type | Method and Description |
---|---|
Aggregation |
as(String label)
Creates an identical aggregation whose output field name
will be the specified label.
|
static Aggregation |
avg(ScalarValuedFunction input)
Create an average value aggregation for the given input.
|
static Aggregation |
avg(String input)
Create an average value aggregation for the given input.
|
static Aggregation |
corr(ScalarValuedFunction input1,
ScalarValuedFunction input2)
Create a correlation aggregation for the given inputs.
|
static Aggregation |
corr(String input1,
String input2)
Create a correlation aggregation for the given inputs.
|
static Aggregation |
count()
Create a count aggregation for all rows within a group.
|
static Aggregation |
count(ScalarValuedFunction input)
Create a value count aggregation for the given input.
|
static Aggregation |
count(String input)
Create a value count aggregation for the given input.
|
static Aggregation |
covar(ScalarValuedFunction input1,
ScalarValuedFunction input2)
Create a covariance aggregation for the given inputs.
|
static Aggregation |
covar(ScalarValuedFunction input1,
ScalarValuedFunction input2,
boolean sample)
Create a covariance aggregation for the given inputs.
|
static Aggregation |
covar(String input1,
String input2)
Create a covariance aggregation for the given inputs.
|
static Aggregation |
covar(String input1,
String input2,
boolean sample)
Create a covariance aggregation for the given inputs.
|
Aggregation |
distinct(boolean distinct)
Creates an identical aggregation whose distinct flag is
set to the specified value.
|
boolean |
equals(Object o) |
static Aggregation |
geoAvg(ScalarValuedFunction input)
Create a geometric average value aggregation for the given input.
|
static Aggregation |
geoAvg(String input)
Create a geometric average value aggregation for the given input.
|
AggregatorFactory |
getAggregatorFactory()
Returns the aggregator factory for this aggregation.
|
String |
getOutputName()
Returns the output name for this aggregation.
|
List<ScalarValuedFunction> |
getSourceFunctions()
Returns the source functions of this aggregation.
|
static Aggregation |
harmAvg(ScalarValuedFunction input)
Create an harmonic average value aggregation for the given input.
|
static Aggregation |
harmAvg(String input)
Create an harmonic average value aggregation for the given input.
|
int |
hashCode() |
boolean |
isDistinct()
Returns whether to compute the aggregation based on the distinct values of the
given field(s).
|
static Aggregation |
kurtosis(ScalarValuedFunction input)
Create a kurtosis aggregation for the given input.
|
static Aggregation |
kurtosis(ScalarValuedFunction input,
boolean sample)
Create a kurtosis aggregation for the given input.
|
static Aggregation |
kurtosis(String input)
Create a kurtosis aggregation for the given input.
|
static Aggregation |
kurtosis(String input,
boolean sample)
Create a kurtosis aggregation for the given input.
|
static Aggregation |
max(ScalarValuedFunction input)
Create a maximum value aggregation for the given input.
|
static Aggregation |
max(String input)
Create a maximum value aggregation for the given input.
|
static Aggregation |
min(ScalarValuedFunction input)
Create a minimum value aggregation for the given input.
|
static Aggregation |
min(String input)
Create a minimum value aggregation for the given input.
|
static Aggregation |
moment(ScalarValuedFunction input,
int k)
Create a central moment aggregation for the given input.
|
static Aggregation |
moment(String input,
int k)
Create a central moment aggregation for the given input.
|
static Aggregation |
skewness(ScalarValuedFunction input)
Create a skewness aggregation for the given input.
|
static Aggregation |
skewness(ScalarValuedFunction input,
boolean sample)
Create a skewness aggregation for the given input.
|
static Aggregation |
skewness(String input)
Create a skewness aggregation for the given input.
|
static Aggregation |
skewness(String input,
boolean sample)
Create a skewness aggregation for the given input.
|
static Aggregation |
stddev(ScalarValuedFunction input)
Create a standard deviation aggregation for the given input.
|
static Aggregation |
stddev(ScalarValuedFunction input,
boolean sample)
Create a standard deviation aggregation for the given input.
|
static Aggregation |
stddev(String input)
Create a standard deviation aggregation for the given input.
|
static Aggregation |
stddev(String input,
boolean sample)
Create a standard deviation aggregation for the given input.
|
static Aggregation |
sum(ScalarValuedFunction input)
Create a value summation aggregation for the given input.
|
static Aggregation |
sum(String input)
Create a value summation aggregation for the given input.
|
static Aggregation |
sumSquares(ScalarValuedFunction input)
Create a sum-squares aggregation for the given input.
|
static Aggregation |
sumSquares(String input)
Create a sum-squares aggregation for the given input.
|
String |
toString() |
void |
validateInputType(RecordTokenType inputType)
Validate the input types to this aggregation.
|
static Aggregation |
var(ScalarValuedFunction input)
Create a variance aggregation for the given input.
|
static Aggregation |
var(ScalarValuedFunction input,
boolean sample)
Create a variance aggregation for the given input.
|
static Aggregation |
var(String input)
Create a variance aggregation for the given input.
|
static Aggregation |
var(String input,
boolean sample)
Create a variance aggregation for the given input.
|
public Aggregation(AggregatorFactory aggregatorFactory, String sourceField)
Aggregation
for a specified record field using specified arguments.aggregatorFactory
- the factory for constructing the desired aggregatorsourceField
- the field to aggregatepublic Aggregation(AggregatorFactory aggregatorFactory, ScalarValuedFunction sourceFunction)
Aggregation
for a specified record field using specified arguments.aggregatorFactory
- the factory for constructing the desired aggregatorsourceFunction
- the function to aggregatepublic Aggregation(AggregatorFactory aggregatorFactory, List<ScalarValuedFunction> sourceFunctions)
Aggregation
for a specified record field using specified arguments.aggregatorFactory
- the factory for constructing the desired aggregatorsourceFields
- the fields to aggregatepublic Aggregation as(String label)
AS
keyword 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")
label
- the name to use for the output fieldpublic Aggregation distinct(boolean distinct)
distinct
- whether to compute distinct aggregationspublic boolean isDistinct()
public List<ScalarValuedFunction> getSourceFunctions()
public AggregatorFactory getAggregatorFactory()
public String getOutputName()
public void validateInputType(RecordTokenType inputType)
inputType
- the type of the record used as input to the aggregationDRException
- 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 typepublic static Aggregation avg(String input)
input
- input field namepublic static Aggregation avg(ScalarValuedFunction input)
input
- input functionpublic static Aggregation count()
public static Aggregation count(String input)
input
- input field namepublic static Aggregation count(ScalarValuedFunction input)
input
- input functionpublic static Aggregation corr(String input1, String input2)
input1
- input field nameinput2
- input field namepublic static Aggregation corr(ScalarValuedFunction input1, ScalarValuedFunction input2)
input1
- input functioninput2
- input functionpublic static Aggregation covar(String input1, String input2)
input1
- input field nameinput2
- input field namepublic static Aggregation covar(String input1, String input2, boolean sample)
input1
- input field nameinput2
- input field namesample
- whether to adjust for samplingpublic static Aggregation covar(ScalarValuedFunction input1, ScalarValuedFunction input2)
input1
- input functioninput2
- input functionpublic static Aggregation covar(ScalarValuedFunction input1, ScalarValuedFunction input2, boolean sample)
input1
- input functioninput2
- input functionsample
- whether to adjust for samplingpublic static Aggregation geoAvg(String input)
input
- input field namepublic static Aggregation geoAvg(ScalarValuedFunction input)
input
- input functionpublic static Aggregation harmAvg(String input)
input
- input field namepublic static Aggregation harmAvg(ScalarValuedFunction input)
input
- input functionpublic static Aggregation kurtosis(String input)
input
- input field namepublic static Aggregation kurtosis(String input, boolean sample)
input
- input field namesample
- whether to adjust for samplingpublic static Aggregation kurtosis(ScalarValuedFunction input)
input
- input functionpublic static Aggregation kurtosis(ScalarValuedFunction input, boolean sample)
input
- input functionsample
- whether to adjust for samplingpublic static Aggregation max(String input)
input
- input field namepublic static Aggregation max(ScalarValuedFunction input)
input
- input field namepublic static Aggregation min(String input)
input
- input field namepublic static Aggregation min(ScalarValuedFunction input)
input
- input functionpublic static Aggregation moment(String input, int k)
input
- input field namek
- the moment to calculate.public static Aggregation moment(ScalarValuedFunction input, int k)
input
- input field namek
- the moment to calculate.public static Aggregation skewness(String input)
input
- input field namepublic static Aggregation skewness(String input, boolean sample)
input
- input field namesample
- whether to adjust for samplingpublic static Aggregation skewness(ScalarValuedFunction input)
input
- input functionpublic static Aggregation skewness(ScalarValuedFunction input, boolean sample)
input
- input functionsample
- whether to adjust for samplingpublic static Aggregation stddev(String input)
input
- input field namepublic static Aggregation stddev(String input, boolean sample)
input
- input field namesample
- whether to adjust for samplingpublic static Aggregation stddev(ScalarValuedFunction input)
input
- input functionpublic static Aggregation stddev(ScalarValuedFunction input, boolean sample)
input
- input functionsample
- whether to adjust for samplingpublic static Aggregation sum(String input)
input
- input field namepublic static Aggregation sum(ScalarValuedFunction input)
input
- input field namepublic static Aggregation sumSquares(String input)
input
- input field namepublic static Aggregation sumSquares(ScalarValuedFunction input)
input
- input functionpublic static Aggregation var(String input)
input
- input field namepublic static Aggregation var(String input, boolean sample)
input
- input field namesample
- whether to adjust for samplingpublic static Aggregation var(ScalarValuedFunction input)
input
- input functionpublic static Aggregation var(ScalarValuedFunction input, boolean sample)
input
- input functionsample
- whether to adjust for samplingCopyright © 2019 Actian Corporation. All rights reserved.