spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <>
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?


Location: *San Francisco, CA*
… or check out my Google+ profile

View raw message