In my old Spark2.X code, I had a following line
pageviewsDF.groupBy( date_format(col("capturedAt"), "u-E").alias("Day Of Week") ).sum('req')
That will give Day of Week as 1-Mon, 2-Tue etc.
But now in Spark3 I get an error that u-E not recognised and I can use legacy setting as below
spark.conf.set("spark.sql.legacy.timeParserPolicy","LEGACY")
But is there a way to get same output without using legacy setting?
You can use the
exprexpression to generate the desired format.