pyspark在Spark SQL中的功能之间的使用范围

时间:2019-07-11 15:12:37

标签: apache-spark pyspark pyspark-sql

我跑步时

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 .. 

正确的语法是什么?

1 个答案:

答案 0 :(得分:1)