S02050

错误代码

S02050

报错信息

The “select“ clause does not support the following functions: aggregate, order-sensitive, row reduction, and null-filling functions. RefId: S02050

错误原因

pivot by 查询中,不允许对查询列应用以下函数:聚合函数、序列函数、行聚合函数(如 rowSum)、填充函数(如 ffill)。否则会出现这个报错,如下例:

time = [10:20:44,10:20:44,10:20:44,10:20:45,10:20:45,10:20:45,10:20:46,10:20:46,10:20:46,10:20:46,10:20:46,10:20:46]
sym = ["A","B","C","A","B","C","A","B","C","A","B","C"]
value = [510,434,999,837,402,615,495,885,745,968,975,165]
t = table(time,sym,value)

db = database("dfs://test_pivot",VALUE,`A`B`C)
pt = db.createPartitionedTable(t,`pt,`sym)
pt.append!(t)

select sum(asis(value)) from pt pivot by time,sym
select cumsum(asis(value)) from pt pivot by time,sym
select rowSum(asis(value)) from pt pivot by time,sym
select ffill(asis(value)) from pt pivot by time,sym

解决办法

根据 pivot by 中关于结合使用 asispivot by 的要求,检查所写的查询语句是否满足这些要求。