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.

相关推荐
q***06474 小时前
Spring Boot 从 2.7.x 升级到 3.3注意事项
数据库·hive·spring boot
心止水j7 小时前
hive分区
数据仓库·hive·hadoop
心止水j7 小时前
Hive 桶表的创建、数据导入、查询与导出
数据仓库·hive·hadoop
8***a8151 天前
从0到1部署Tomcat和添加servlet(IDEA2024最新版详细教程)
hive·servlet·tomcat
5***79002 天前
JavaScript生成器函数
hive·tidb·consul
顧棟3 天前
HDFS元数据与auditlog结合Hive元数据统计分析
hive·hadoop·hdfs
z***89713 天前
【分布式】Hadoop完全分布式的搭建(零基础)
大数据·hadoop·分布式
Kevinyu_3 天前
责任链模式
java·hadoop·责任链模式
yumgpkpm3 天前
腾讯云TBDS与CDH迁移常见问题有哪些?建议由CDH迁移到CMP 7.13 平台(类Cloudera CDP,如华为鲲鹏 ARM 版)
hive·hadoop·zookeeper·flink·spark·kafka·hbase
hexionly3 天前
数据仓库·架构,建模(二)
数据仓库