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 >