You can use rank window function to rank each row in the group, and then filter the rowz with rank < 50
On Wed, Jul 6, 2016, 14:07 <luohui20...@sina.com> wrote: > hi there > I have a DF with 3 columns: id , pv, location.(the rows are already > grouped by location and sort by pv in des) I wanna get the first 50 id > values grouped by location. I checked the API of > dataframe,groupeddata,pairRDD, and found no match. > is there a way to do this naturally? > any info will be appreciated. > > > > -------------------------------- > > Thanks&Best regards! > San.Luo >