@InterfaceStability.Experimental @InterfaceAudience.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
Constructor and Description |
---|
AggregateFunctions() |
Modifier and Type | Method and 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 group
|
static 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) |
public static Expression arrayAgg(Expression expression)
Returned expression results in a array of the non-MISSING values in the group, including NULLs.
public static Expression arrayAgg(String expression)
Returned expression results in a array of the non-MISSING values in the group, including NULLs.
public static Expression avg(Expression expression)
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group.
public static Expression avg(String expression)
Returned expression results in the arithmetic mean (average) of all the distinct number values in the group.
public static Expression count(Expression expression)
Returned expression results in count of all the non-NULL and non-MISSING values in the group.
public static Expression count(String expression)
Returned expression results in count of all the non-NULL and non-MISSING values in the group
public static Expression countAll()
Returned expression results in a count of all the input rows for the group, regardless of value (including NULL).
public static Expression max(Expression expression)
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order.
public static Expression max(String expression)
Returned expression results in the maximum non-NULL, non-MISSING value in the group in N1QL collation order.
public static Expression min(Expression expression)
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order.
public static Expression min(String expression)
Returned expression results in the minimum non-NULL, non-MISSING value in the group in N1QL collation order.
public static Expression sum(Expression expression)
Returned expression results in the sum of all the number values in the group.
public static Expression sum(String expression)
public static Expression distinct(Expression expression)
prefixes an expression with DISTINCT, useful for example for distinct count “COUNT(DISTINCT expression)”.
public static Expression distinct(String expression)
prefixes an expression with DISTINCT, useful for example for distinct count “COUNT(DISTINCT expression)”.
Copyright © 2015 Couchbase, Inc.