hive窗口函数数据范围

window的内包括:

复制代码
(ROWS | RANGE) BETWEEN (UNBOUNDED | [num]) PRECEDING AND ([num] PRECEDING | CURRENT ROW | (UNBOUNDED | [num]) FOLLOWING)
(ROWS | RANGE) BETWEEN CURRENT ROW AND (CURRENT ROW | (UNBOUNDED | [num]) FOLLOWING)
(ROWS | RANGE) BETWEEN [num] FOLLOWING AND (UNBOUNDED | [num]) FOLLOWING

如何指定了order by,但是没有指定窗口,统计的数据是开始到当前行。

|---------------------------------------------------------------|
| SELECT a, SUM(b) OVER (PARTITION BY c ORDER BY d) FROM T; |

When ORDER BY is specified with missing WINDOW clause, the WINDOW specification defaults to RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.

如果order by和 window都没有指定,那就是整个数据集

SELECT a, COUNT(b) OVER (PARTITION BY c, d)

FROM T;

When both ORDER BY and WINDOW clauses are missing, the WINDOW specification defaults to ROW BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING.

相关推荐
时差95314 小时前
【面试题】Hive 查询:如何查找用户连续三天登录的记录
大数据·数据库·hive·sql·面试·database
苍老流年14 小时前
Hive中各种Join的实现
数据仓库·hive·hadoop
静听山水14 小时前
Hive:UDTF 函数
hive
EDG Zmjjkk15 小时前
Hive 查询(详细实操版)
数据仓库·hive·hadoop
lzhlizihang17 小时前
【Hive sql 面试题】求出各类型专利top 10申请人,以及对应的专利申请数(难)
大数据·hive·sql·面试题
Hsu_kk17 小时前
Hive 查询各类型专利 Top 10 申请人及对应的专利申请数
数据仓库·hive·hadoop
静听山水17 小时前
Hive 的数据存储单元结构
hive
大数据编程之光17 小时前
Hive 查询各类型专利 top10 申请人及专利申请数
大数据·数据仓库·hive·hadoop
杰克逊的日记17 小时前
Hive详解
数据仓库·hive·hadoop
上辈子杀猪这辈子学IT17 小时前
【Zookeeper集群搭建】安装zookeeper、zookeeper集群配置、zookeeper启动与关闭、zookeeper的shell命令操作
linux·hadoop·zookeeper·centos·debian