spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <bur...@spinn3r.com>
Subject Rank for SQL and ORDER BY?
Date Sat, 10 Jan 2015 01:32:01 GMT
I’m trying to do simple graph sort in Spark which I mostly have working.

The one problem I have now is that I need to order them and then assign a
rank position.

So the top item should have rank 0, the next one should have rank 1, etc.

Hive and Pig support this with the RANK operator.

I *think* this is how I would do it with Hive.

SELECT target, COUNT(source) AS indegree, rank() OVER (ORDER BY indegree
DESC) AS rank FROM mygraph GROUP BY target ORDER BY indegree DESC

But that doesn’t seem to work.  What’s the easiest way to accomplish this
in Spark?

Any advice?

-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Mime
View raw message