SET hiveconf:window_size = 12
SELECT id , max(marks) OVER(ORDER BY Date_time ROWS BETWEEN ${hiveconf:window_size}-1 PRECEDING AND CURRENT ROW) from Students;
SET hiveconf:window_size=11;
SELECT id , max(marks) OVER(ORDER BY Date_time ROWS BETWEEN ${hiveconf:window_size} PRECEDING AND CURRENT ROW) from Students
;
1条答案
按热度按时间iq0todco1#
它不喜欢边界之间行的内联计算。执行查询前减去1。
这将起作用:
或者,您可以在shell中计算它,并将其作为变量传递给配置单元脚本。请参见如何从shell传递变量:https://stackoverflow.com/a/37821218/2700344