为什么使用秩()窗函数打破解析器? [英] Why does using rank() windowing function break the parser?
本文介绍了为什么使用秩()窗函数打破解析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在窗口函数在线文档的火花SQL包括下面的例子:
The windowing functions online docs for spark sql include the following example:
的https://databricks.com/blog/2015/07/15/introducing-window-functions-in-spark-sql.html
SELECT
product,
category,
revenue
FROM (
SELECT
product,
category,
revenue,
dense_rank() OVER (PARTITION BY category ORDER BY revenue DESC) as rank
FROM productRevenue) tmp
WHERE
rank <= 2
我已经创造了什么似乎是相似的结构SQL。但是,这是行不通的。
I have created what would seem to be a similar structure sql. But it does not work
select id,r from (
select id, name,
rank() over (partition by name order by name) as r
from tt) v
where v.r >= 7 and v.r <= 12
以下是错误:
Exception in thread "main" java.lang.RuntimeException: [3.25]
failure: ``)'' expected but `(' found
rank() over (partition by fp order by fp) as myrank
^
任何人都可以看到它们的不同结构?我对火花1.6.0-快照15年11月18日。
Anyone can see where they differ structurally? I am on spark 1.6.0-SNAPSHOT from 11/18/15.
推荐答案
我查源$ C $ c和它出现在等级()要求蜂巢的支持。我重建火花与
I checked the source code and it appears the rank() requires hive support. I am rebuilding spark with
-Phive -Phive-thriftserver
我做了证实:使用时, HiveContext
的查询工作。
这篇关于为什么使用秩()窗函数打破解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文