Thank you sir.
Can one do this sorting without using temporary table if possible?
Best 

    On Saturday, 27 February 2016, 18:50, Yin Yang <yy201...@gmail.com> wrote:
 

 scala>  Seq((1, "b", "test"), (2, "a", "foo")).toDF("id", "a", 
"b").registerTempTable("test")
scala> val df = sql("SELECT struct(id, b, a) from test order by b")df: 
org.apache.spark.sql.DataFrame = [struct(id, b, a): struct<id: int, b: string 
... 1 more field>]
scala> df.show+----------------+|struct(id, b, a)|+----------------+|       
[2,foo,a]||      [1,test,b]|+----------------+
On Sat, Feb 27, 2016 at 10:25 AM, Ashok Kumar <ashok34...@yahoo.com.invalid> 
wrote:

 Hello,
I like to be able to solve this using arrays.
I have two dimensional array of (String,Int) with 5  entries say arr("A",20), 
arr("B",13), arr("C", 18), arr("D",10), arr("E",19)
I like to write a small code to order these in the order of highest Int column 
so I will have arr("A",20), arr("E",19), arr("C",18) ....
What is the best way of doing this using arrays only?
Thanks



  

Reply via email to