How to calculate Median in spark sqlContext for column of data type double

前端 未结 3 955
温柔的废话
温柔的废话 2020-12-03 15:48

I have given the sample table. I want to get the median from \"value\" column for each group \"source\" column. Where source column is of String DataType value column is of

3条回答
  •  渐次进展
    2020-12-03 16:37

    Have you tried the DataFrame.describe() method?

    https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/DataFrame.html#describe(java.lang.String...)

    not sure it's exactly what you're looking for, but might get you closer.

提交回复
热议问题