内置的聚合函数

  

返回类型

  

函数

说明

bigint

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

返回记录条数。

double

sum(col), sum(DISTINCT col)

求和

double

avg(col), avg(DISTINCT col)

求平均值

double

min(col)

返回指定列中最小值

double

max(col)

返回指定列中最大值

double

var_pop(col)

返回指定列的方差

double

var_samp(col)

返回指定列的样本方差

double

stddev_pop(col)

返回指定列的偏差

double

stddev_samp(col)

返回指定列的样本偏差

double

covar_pop(col1, col2)

两列数值协方差

double

covar_samp(col1, col2)

两列数值样本协方差

double

corr(col1, col2)

返回两列数值的相关系数

double

percentile(col, p)

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

array<double>

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

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

double

percentile_approx(col, p[, B])

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

array<double>

percentile_approx(col, array(p~1,, [, p,,2_]…)  [, B])

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

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

histogram_numeric(col, b)

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

array

collect_set(col)

返回无重复记录



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

关注超人学院微信二维码:

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

转载于:https://my.oschina.net/crxy/blog/425385

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值