Class AggregateFunction
java.lang.Object
com.google.cloud.firestore.pipeline.expressions.AggregateFunction
A class that represents an aggregate function.
-
Method Summary
Modifier and TypeMethodDescriptionAssigns an alias to this aggregate.static AggregateFunctionaverage(Expression expression) Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs.static AggregateFunctionCreates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs.static AggregateFunctioncount(Expression expression) Creates an aggregation that counts the number of stage inputs with valid evaluations of the providedexpression.static AggregateFunctionCreates an aggregation that counts the number of stage inputs where the input field exists.static AggregateFunctioncountAll()Creates an aggregation that counts the total number of stage inputs.static AggregateFunctioncountDistinct(Expression expression) Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs.static AggregateFunctioncountDistinct(String fieldName) Creates an aggregation that counts the number of distinct values of a field across multiple stage inputs.static AggregateFunctioncountIf(BooleanExpression condition) Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true.static AggregateFunctionmaximum(Expression expression) Creates an aggregation that finds the maximum value of an expression across multiple stage inputs.static AggregateFunctionCreates an aggregation that finds the maximum value of a field across multiple stage inputs.static AggregateFunctionminimum(Expression expression) Creates an aggregation that finds the minimum value of an expression across multiple stage inputs.static AggregateFunctionCreates an aggregation that finds the minimum value of a field across multiple stage inputs.static AggregateFunctionrawAggregate(String name, Expression... expr) Creates a raw aggregation function.static AggregateFunctionsum(Expression expression) Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs.static AggregateFunctionCreates an aggregation that calculates the sum of a field's values across multiple stage inputs.
-
Method Details
-
rawAggregate
Creates a raw aggregation function.This method provides a way to call aggregation functions that are supported by the Firestore backend but that are not available as specific factory methods in this class.
- Parameters:
name- The name of the aggregation function.expr- The expressions to pass as arguments to the function.- Returns:
- A new
AggregateFunctionfor the specified function.
-
countAll
Creates an aggregation that counts the total number of stage inputs.- Returns:
- A new
AggregateFunctionrepresenting the countAll aggregation.
-
count
Creates an aggregation that counts the number of stage inputs where the input field exists.- Parameters:
fieldName- The name of the field to count.- Returns:
- A new
AggregateFunctionrepresenting the 'count' aggregation.
-
count
Creates an aggregation that counts the number of stage inputs with valid evaluations of the providedexpression.- Parameters:
expression- The expression to count.- Returns:
- A new
AggregateFunctionrepresenting the 'count' aggregation.
-
countDistinct
Creates an aggregation that counts the number of distinct values of a field across multiple stage inputs.- Parameters:
fieldName- The name of the field to count the distinct values of.- Returns:
- A new
AggregateFunctionrepresenting the count distinct aggregation.
-
countDistinct
Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs.- Parameters:
expression- The expression to count the distinct values of.- Returns:
- A new
AggregateFunctionrepresenting the count distinct aggregation.
-
countIf
Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true.- Parameters:
condition- The boolean expression to evaluate on each input.- Returns:
- A new
AggregateFunctionrepresenting the count aggregation.
-
sum
Creates an aggregation that calculates the sum of a field's values across multiple stage inputs.- Parameters:
fieldName- The name of the field containing numeric values to sum up.- Returns:
- A new
AggregateFunctionrepresenting the sum aggregation.
-
sum
Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs.- Parameters:
expression- The expression to sum up.- Returns:
- A new
AggregateFunctionrepresenting the sum aggregation.
-
average
Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs.- Parameters:
fieldName- The name of the field containing numeric values to average.- Returns:
- A new
AggregateFunctionrepresenting the average aggregation.
-
average
Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs.- Parameters:
expression- The expression representing the values to average.- Returns:
- A new
AggregateFunctionrepresenting the average aggregation.
-
minimum
Creates an aggregation that finds the minimum value of a field across multiple stage inputs.- Parameters:
fieldName- The name of the field to find the minimum value of.- Returns:
- A new
AggregateFunctionrepresenting the minimum aggregation.
-
minimum
Creates an aggregation that finds the minimum value of an expression across multiple stage inputs.- Parameters:
expression- The expression to find the minimum value of.- Returns:
- A new
AggregateFunctionrepresenting the minimum aggregation.
-
maximum
Creates an aggregation that finds the maximum value of a field across multiple stage inputs.- Parameters:
fieldName- The name of the field to find the maximum value of.- Returns:
- A new
AggregateFunctionrepresenting the maximum aggregation.
-
maximum
Creates an aggregation that finds the maximum value of an expression across multiple stage inputs.- Parameters:
expression- The expression to find the maximum value of.- Returns:
- A new
AggregateFunctionrepresenting the maximum aggregation.
-
as
Assigns an alias to this aggregate.- Parameters:
alias- The alias to assign to this aggregate.- Returns:
- A new
AliasedAggregatethat wraps this aggregate and associates it with the provided alias.
-