加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

内置的聚合函数

发布时间:2020-12-14 05:17:20 所属栏目:百科 来源:网络整理
导读:?? 返回类型 ?? 函数 说明 bigint count(*),count(expr),count(DISTINCT expr[,??expr_.,expr_.]) 返回记录条数。 double sum(col),sum(DISTINCT col) 求和 avg(col),avg(DISTINCT col) 求平均值 min(col) 返回指定列中最小值 max(col) 返回指定列中最大值 v

??
返回类型
??
函数
说明
bigint
count(*),count(expr),count(DISTINCT expr[,??expr_.,expr_.])
返回记录条数。
double
sum(col),sum(DISTINCT col)
求和
avg(col),avg(DISTINCT col)
求平均值
min(col)
返回指定列中最小值
max(col)
返回指定列中最大值
var_pop(col)
返回指定列的方差
var_samp(col)
返回指定列的样本方差
stddev_pop(col)
返回指定列的偏差
stddev_samp(col)
返回指定列的样本偏差
covar_pop(col1,col2)
两列数值协方差
covar_samp(col1,245); overflow:hidden">
两列数值样本协方差
corr(col1,245); overflow:hidden">
返回两列数值的相关系数
percentile(col,p)
返回数值区域的百分比数值点。0<=P<=1,否则返回NULL,不支持浮点型数值。
array<double>
返回数值区域的一组百分比值分别对应的数值点。0<=P<=1,245); overflow:hidden">
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.
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免费学习交流群:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读