Error: msum(X, window, [minPeriods]). window must be at least 2. What is the reason?

I have tried using msum with variable window according to the function as under but it always give me an error " window must be at least 2 "

please help me.


This is my stream table.

share streamTable(1:0, `ts`symbol`price`vol`time, [TIMESTAMP,SYMBOL,DOUBLE,DOUBLE,TIMESTAMP]) as ip1

This is my normal table.

t3 = select *,mod(minute(ts),5)+2 as v1 from ip1


This gives an error

select *,mod(minute(ts),5), msum(vol,int(mod(minute(ts),5)+2)) from ip1

select mod(minute(ts),5), msum(vol,int(mod(minute(ts),5)+2)) from ip1


This also gives error

select *, msum(vol,int(v1)) from t3

select msum(vol,int(v1)) from t3


Basically I want variable value of window based on mod with ts.

请先 登录 后评论

1 个回答

jinzhi

msum is an aggregate function, it can not be used with '*'. 

请先 登录 后评论
  • 1 关注
  • 0 收藏,1044 浏览
  • Vishvesh Upadhyay 提出于 2022-01-05 03:11

相似问题