内置的聚合函数

前端之家收集整理的这篇文章主要介绍了内置的聚合函数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_11@

函数

@H_404_11@

count(*),count(expr),count(DISTINCT expr[,expr_.,expr_.])

@H_404_11@

sum(col),sum(DISTINCT col)

@H_404_11@

avg(col),avg(DISTINCT col)

@H_404_11@

min(col)

@H_404_11@

max(col)

@H_404_11@

var_pop(col)

@H_404_11@

var_samp(col)

@H_404_11@

stddev_pop(col)

@H_404_11@

stddev_samp(col)

@H_404_11@

covar_pop(col1,col2)

@H_404_11@

covar_samp(col1,col2)

@H_404_11@

corr(col1,col2)

@H_404_11@

percentile(col,p)

@H_404_11@

percentile(col,array(p~1,\ [,p,2,]…))

@H_404_11@

percentile_approx(col,p[,B])

@H_404_11@

percentile_approx(col,[,2_]…)[,B])

@H_404_11@

histogram_numeric(col,b)

@H_404_11@

collect_set(col)

返回类型

说明

bigint

返回记录条数。

double

求和

double

求平均值

double

返回指定列中最小值

double

返回指定列中最大值

double

返回指定列的方差

double

返回指定列的样本方差

double

返回指定列的偏差

double

返回指定列的样本偏差

double

两列数值协方差

double

两列数值样本协方差

double

返回两列数值的相关系数

double

返回数值区域的百分比数值点。0<=P<=1,否则返回NULL,不支持浮点型数值。

array<double>

返回数值区域的一组百分比值分别对应的数值点。0<=P<=1,不支持浮点型数值。

double

Returns an approximate p^th^ percentile of anumeric column (including floating point types) in the group. The B parametercontrols approximation accuracy at the cost of memory. Higher values yieldbetter approximations,and the default is 10,000. When the number of distinctvalues in col is smaller than B,this gives an exact percentile value.

array<double>

Same as above,but accepts and returns an arrayof percentile values instead of a single one.

array<struct\{‘x’,'y’\}>

Computes a histogram of a numeric column in thegroup using b non-uniformly spaced bins. The output is an array of size b ofdouble-valued (x,y) coordinates that represent the bin centers and heights

array

返回无重复记录

更多精彩内容请关注:http://bbs.superwu.cn


关注超人学院微信二维码

关注超人学院java免费学习交流群:

猜你在找的设计模式相关文章