我跑步时
spark.sql('''
select client,avg(amount) over (partition by client
order by my_timestamp
range between interval 30 days preceding and current row) as moving_avg_amount
from my_table''')
有效。
但是如果我想排除最近X天-它将失败。
... range between interval 30 days preceding and 12 days preceding ..
or :
... range between interval 30 days preceding and interval 12 days preceding ..
正确的语法是什么?
答案 0 :(得分:1)