In the case of Java:
If we use DataFrames , applying joins (here Inner join), we can sort (in ASC) after selecting different elements in each DF as:
Dataset<Row> d1 = e_data.distinct().join(s_data.distinct(), "e_id").orderBy("salary");
where e_id is the column to which the join applies when sorting by salary in ASC.
We can also use Spark SQL as:
SQLContext sqlCtx = spark.sqlContext(); sqlCtx.sql("select * from global_temp.salary order by salary desc").show();
Where
- spark → SparkSession
- Salary → GlobalTemp View.
RPaul Sep 06 '18 at 16:12 2018-09-06 16:12
source share