spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohannad Ali <man...@gmail.com>
Subject Re: Sorting the dataframe
Date Fri, 04 Mar 2016 08:36:09 GMT
You can call orderBy on the dataframe directly:
http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.DataFrame
On Mar 4, 2016 09:18, "Angel Angel" <areyouangel90@gmail.com> wrote:

> hello sir,
>
>  i want to sort the following table as per the *count*
>
> value count
> 52639 22
> 75243 4
> 13 55
> 56 5
> 185463 45
> 324364 32
>
>
> So first i convert the my dataframe to to rdd to sort the table.
>
> val k = table.rdd
>
> convert the rdd array into key value pair.
>
> val s =k.take(6)
>
> val rdd = s.map(x=> x(1),(x(0)).
> rdd.sortByKey
>
>
>
> this is my all operations i did to sort the table.
>
> Please can you suggest me the better way to sort the table
>

Mime
View raw message