Fetching distinct values on a column using Spark DataFrame
Well to obtain all different values in a Dataframe you can use distinct. As you can see in the documentation that method returns another DataFrame. After that you can create a UDF in order to transform each record. For example: val df = sc.parallelize(Array((1, 2), (3, 4), (1, 6))).toDF(“age”, “salary”) // I obtain all different … Read more