数据湖探索 DLI-Over聚合:示例

时间:2024-11-16 13:21:44

示例

查询为每个订单计算前一个小时之内接收到的同一产品所有订单的总金额。

1
2
3
4
5
6
7
SELECT order_id, order_time, amount,
  SUM(amount) OVER (
    PARTITION BY product
    ORDER BY order_time
    RANGE BETWEEN INTERVAL '1' HOUR PRECEDING AND CURRENT ROW
  ) AS one_hour_prod_amount_sum
FROM Orders
support.huaweicloud.com/sqlref-flink-dli/dli_08_15076.html