You should generally think of a DataFrame as unordered, unless you are explicitly asking for an order. One way to order and assign an index is with window functions <https://databricks.com/blog/2015/07/15/introducing-window-functions-in-spark-sql.html> .
On Tue, Apr 5, 2016 at 4:17 AM, Angel Angel <areyouange...@gmail.com> wrote: > Hello, > > i am writing one spark application i which i need the index of the maximum > element. > > My table has one column only and i want the index of the maximum element. > > MAX(count) > 23 > 32 > 3 > Here is my code the data type of the array is > org.apache.spark.sql.Dataframe. > > > Thanks in advance. > Also please suggest me to do it in another way. > > [image: Inline image 1] >