基于范围 window 框架只能有 1 个排序键
Range based window Frame can have only 1 sort key
我试过运行下一个查询
select sum(balance) over (partition by client order by card desc, date_tr desc)
from table_1
在结果中我有下一条错误消息:
FAILED: SemanticException Range based Window Frame can have only 1 Sort key
我真的不能在 order by
句子中使用 2 个排序键吗?或者有什么方法可以使用 2 个排序键?
您的代码应该可以工作。 language manual 有一个非常相似的例子。
也就是说,显式 window 子句可能会绕过错误:
select sum(balance) over (partition by client
order by card desc, date_tr desc
rows between unbounded preceding and current row
)
from table_1
请查看此答案以了解 GROUP 和 PARTITION BY 之间的区别,它应该可以工作,但它取决于您到底想要什么:Difference GROUP BY and PARTITION BY
我试过运行下一个查询
select sum(balance) over (partition by client order by card desc, date_tr desc)
from table_1
在结果中我有下一条错误消息:
FAILED: SemanticException Range based Window Frame can have only 1 Sort key
我真的不能在 order by
句子中使用 2 个排序键吗?或者有什么方法可以使用 2 个排序键?
您的代码应该可以工作。 language manual 有一个非常相似的例子。
也就是说,显式 window 子句可能会绕过错误:
select sum(balance) over (partition by client
order by card desc, date_tr desc
rows between unbounded preceding and current row
)
from table_1
请查看此答案以了解 GROUP 和 PARTITION BY 之间的区别,它应该可以工作,但它取决于您到底想要什么:Difference GROUP BY and PARTITION BY