聚合操作 | 表达式 | 含义 | 例子 | 支持流式 Group窗口 | 支持流式 Over开窗 | 支持批式 Group窗口 | 支持批式 Over开窗 |
COUNT | COUNT([ALL | DISTINCT] col) | 计算窗口内数据条数 | COUNT(value) AS result |
|
|
|
|
COUNT_PRECEDING | COUNT_PRECEDING([ALL | DISTINCT] col) | 计算窗口内数据条数(不包括当前值) | COUNT_PRECEDING(value) AS result |
|
|
|
|
SUM | SUM([ALL | DISTINCT] col) | 计算窗口内指定列的和 | SUM(value) AS result |
|
|
|
|
SUM_PRECEDING | SUM_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的和(不包括当前值) | SUM_PRECEDING(value) AS result |
|
|
|
|
AVG | AVG([ALL | DISTINCT] col) | 计算窗口内指定列的均值 | AVG(value) AS result |
|
|
|
|
AVG_PRECEDING | AVG_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的均值(不包括当前值) | AVG_PRECEDING(value) AS result |
|
|
|
|
MIN | MIN([ALL | DISTINCT] col) | 计算窗口内指定列的最小值 | MIN(value) AS result |
|
|
|
|
MIN_PRECEDING | MIN_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的最小值(不包括当前值) | MIN_PRECEDING(value) AS result |
|
|
|
|
MAX | MAX([ALL | DISTINCT] col) | 计算窗口内指定列的最大值 | MAX(value) AS result |
|
|
|
|
MAX_PRECEDING | MAX_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的最大值(不包括当前值) | MAX_PRECEDING(value) AS result |
|
|
|
|
STDDEV_SAMP | STDDEV_SAMP([ALL | DISTINCT] col) | 计算窗口内指定列的样本标准差 | STDDEV_SAMP(value) AS result |
|
|
|
|
STDDEV_SAMP_PRECEDING | STDDEV_SAMP_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的样本标准差(不包括当前值) | STDDEV_SAMP_PRECEDING(value) AS result |
|
|
|
|
STDDEV_POP | STDDEV_POP([ALL | DISTINCT] col) | 计算窗口内指定列的总体标准差 | STDDEV_POP(value) AS result |
|
|
|
|
STDDEV_POP_PRECEDING | STDDEV_POP_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的总体标准差(不包括当前值) | STDDEV_POP_PRECEDING(value) AS result |
|
|
|
|
VAR_SAMP | VAR_SAMP([ALL | DISTINCT] col) | 计算窗口内指定列的样本方差 | VAR_SAMP(value) AS result |
|
|
|
|
VAR_SAMP_PRECEDING | VAR_SAMP_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的样本方差(不包括当前值) | VAR_SAMP_PRECEDING(value) AS result |
|
|
|
|
VAR_POP | VAR_POP([ALL | DISTINCT] col) | 计算窗口内指定列的总体方差 | VAR_POP(value) AS result |
|
|
|
|
VAR_POP_PRECEDING | VAR_POP_PRECEDING([ALL | DISTINCT] col) | 计算窗口内指定列的总体方差(不包括当前值) | VAR_POP_PRECEDING(value) AS result |
|
|
|
|
SKEWNESS | SKEWNESS(col) | 计算窗口内指定列的偏度 | SKEWNESS(value) AS result |
|
|
|
|
SKEWNESS_PRECEDING | SKEWNESS_PRECEDING(col) | 计算窗口内指定列的偏度不包括当前值) | SKEWNESS_PRECEDING(value) AS result |
|
|
|
|
SUM_LAST | SUM_LAST(col [, k]) | 返回窗口内最近k个值的和 | SUM_LAST(value) AS result |
|
|
|
|
SQUARE_SUM | SQUARE_SUM(col) | 返回窗口内的平方和 | SQUARE_SUM(value) AS result |
|
|
|
|
SQUARE_SUM_PRECEDING | SQUARE_SUM_PRECEDING(col) | 返回窗口内的平方和(不包括当前值) | SQUARE_SUM_PRECEDING(value) AS result |
|
|
|
|
MEDIAN | MEDIAN(col) | 返回窗口内的中位数 | MEDIAN(value) AS result |
|
|
|
|
MEDIAN_PRECEDING | MEDIAN_PRECEDING(col) | 返回窗口内的中位数(不包括当前值) | MEDIAN_PRECEDING(value) AS result |
|
|
|
|
MODE | MODE(col) | 返回窗口内的众数 | MODE(value) AS result |
|
|
|
|
MODE_PRECEDING | MODE_PRECEDING(col) | 返回窗口内的众数(不包括当前值) | MODE_PRECEDING(value) AS result |
|
|
|
|
FREQ | FREQ(col) | 返回当前数据在窗口内出现次数 | FREQ(value) AS result |
|
|
|
|
FREQ_PRECEDING | FREQ_PRECEDING(col) | 返回当前数据在窗口内出现次数(不包括当前值) | FREQ_PRECEDING(value) AS result |
|
|
|
|
RANK | RANK() | 计算当前数据在窗口内的排名,生成序号不连续 | RANK(value) AS result |
|
|
|
|
DENSE_RANK | DENSE_RANK() | 计算当前数据在窗口内的排名,生成序号连续 | DENSE_RANK(value) AS result |
|
|
|
|
ROW_NUMBER | ROW_NUMBER() | 计算当前数据在窗口内的行号 | ROW_NUMBER()as result |
|
|
|
|
LAG | LAG(col [, offset] [, default]) | 计算当前值前offset个值,如果没有返回default | LAG(value) AS result |
|
|
|
|
LAG_INCLUDING_NULL | LAG_INCLUDING_NULL(col [, offset] [, default]) | 计算当前值前offset个值,如果没有返回default | LAG_INCLUDING_NULL(value) AS result |
|
|
|
|
LAST_DISTINCT | LAST_DISTINCT(col) | 返回窗口内上一个与当前值不同的值 | LAST_DISTINCT(value) AS result |
|
|
|
|
LAST_TIME | LAST_TIME(col) | 返回窗口内上一个数据的时间 | LAST_TIME(col) AS result |
|
|
|
|
LAST_VALUE | LAST_VALUE(col) | 返回窗口内上一条数据 | LAST_VALUE(value) AS result |
|
|
|
|
IS_EXIST | IS_EXIST(col) | 返回当前数据是否在窗口内出现过 | IS_EXIST(value) AS result |
|
|
|
|
CONCAT_AGG | CONCAT_AGG(col [, delimiter]) | 返回窗口内数据的拼接值 | CONCAT_AGG(value) AS result |
|
|
|
|
CONCAT_AGG_PRECEDING | CONCAT_AGG_PRECEDING(col [, delimiter]) | 返回窗口内数据的拼接值(不包括当前值) | CONCAT_AGG_PRECEDING(value) AS result |
|
|
|
|
MTABLE_AGG | MTABLE_AGG(col1, col2...) | 返回窗口内数据的聚合MTABLE | MTABLE_AGG(value1, value2, value3) AS result |
|
|
|
|
MTABLE_AGG_PRECEDING | MTABLE_AGG_PRECEDING(col1, col2...) | 返回窗口内数据的聚合MTABLE (不包括当前值) | MTABLE_AGG_PRECEDING(value1, value2, value3) AS result |
|
|
|
|
对应的窗口组件: