Re: OrderBy Year and Month is not displaying correctly

2020-01-06 Thread Mich Talebzadeh
*The distinct transformation does not preserve order, you need to distinct first, then orderby.* Thanks Enrico. You are correct. Worked fine! joint_accounts. select(year(col("transactiondate")).as("Year") , month(col("transactiondate")).as("Month") ,

Re: OrderBy Year and Month is not displaying correctly

2020-01-06 Thread Gourav Sengupta
or just use SQL, which is less verbose, easily readable, and takes care of all such scenarios. But for some weird reason I have found that people using data frame API's have a perception that using SQL is less intelligent. But I think that using less effort to get better output can me a measure of

Re: OrderBy Year and Month is not displaying correctly

2020-01-06 Thread Enrico Minack
The distinct transformation does not preserve order, you need to distinct first, then orderby. Enrico Am 06.01.20 um 00:39 schrieb Mich Talebzadeh: Hi, I am working out monthly outgoing etc from an account and I am using the following code import org.apache.spark.sql.expressions.Window

OrderBy Year and Month is not displaying correctly

2020-01-05 Thread Mich Talebzadeh
Hi, I am working out monthly outgoing etc from an account and I am using the following code import org.apache.spark.sql.expressions.Window val wSpec = Window.partitionBy(year(col("transactiondate")),month(col("transactiondate"))) joint_accounts.