Class AggregateFunctions
java.lang.Object
com.couchbase.client.java.query.dsl.functions.AggregateFunctions
@Experimental @Public public class AggregateFunctions extends Object
DSL for N1QL functions in the aggregate category.
Aggregate functions take multiple values from documents, perform calculations, and return a single
value as the result.
You can only use aggregate functions in SELECT, LETTING, HAVING, and ORDER BY clauses.
When using an aggregate function in a query, the query operates as an aggregate query.
See N1QL reference documentation: http://docs.couchbase.com/4.0/n1ql/n1ql-language-reference/aggregatefun.html
- Since:
- 2.2
- Author:
- Simon Baslé
-
Method Summary
Modifier and Type Method Description static Expression
arrayAgg(Expression expression)
Returned expression results in a array of the non-MISSING values in the group, including NULLs.static Expression
arrayAgg(String expression)
Returned expression results in a array of the non-MISSING values in the group, including NULLs.static Expression
avg(Expression expression)
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group.static Expression
avg(String expression)
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group.static Expression
count(Expression expression)
Returned expression results in count of all the non-NULL and non-MISSING values in the group.static Expression
count(String expression)
Returned expression results in count of all the non-NULL and non-MISSING values in the groupstatic Expression
countAll()
Returned expression results in a count of all the input rows for the group, regardless of value (including NULL).static Expression
distinct(Expression expression)
prefixes an expression with DISTINCT, useful for example for distinct count "COUNT(DISTINCT expression)".static Expression
distinct(String expression)
prefixes an expression with DISTINCT, useful for example for distinct count "COUNT(DISTINCT expression)".static Expression
max(Expression expression)
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order.static Expression
max(String expression)
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order.static Expression
min(Expression expression)
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order.static Expression
min(String expression)
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order.static Expression
sum(Expression expression)
Returned expression results in the sum of all the number values in the group.static Expression
sum(String expression)
-
Method Details
-
arrayAgg
Returned expression results in a array of the non-MISSING values in the group, including NULLs. -
arrayAgg
Returned expression results in a array of the non-MISSING values in the group, including NULLs. -
avg
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group. -
avg
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group. -
count
Returned expression results in count of all the non-NULL and non-MISSING values in the group. -
count
Returned expression results in count of all the non-NULL and non-MISSING values in the group -
countAll
Returned expression results in a count of all the input rows for the group, regardless of value (including NULL). -
max
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order. -
max
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order. -
min
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order. -
min
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order. -
sum
Returned expression results in the sum of all the number values in the group. -
sum
-
distinct
prefixes an expression with DISTINCT, useful for example for distinct count "COUNT(DISTINCT expression)". -
distinct
prefixes an expression with DISTINCT, useful for example for distinct count "COUNT(DISTINCT expression)".
-