get min and max from a specific column scala spark dataframe

后端 未结 7 1075
梦谈多话
梦谈多话 2021-02-01 04:37

I would like to access to the min and max of a specific column from my dataframe but I don\'t have the header of the column, just its number, so I should I do using scala ?

7条回答
  •  不思量自难忘°
    2021-02-01 05:12

    In Java, we have to explicitly mention org.apache.spark.sql.functions that has implementation for min and max:

    datasetFreq.agg(functions.min("Frequency"), functions.max("Frequency")).show();
    

提交回复
热议问题