The fact that the Query SELECT date_format(‘2020-12-30’, ‘yyyy-ww’) as calendar_week FROM inputTable i returns 2020-01 is probably no ONE DATA bug but a problem in Spark SQL outside our control?
SQL query select statement with date formats as Spark SQL problem?
Ah okay, it does seem to be spark issues…
Have your tried converting “2020-12-30” to a date/timestamp before getting the calendar week from it?
Yes @thomas.danzer , it usually is a timestamp. I wrote it like this for posting it here. But it does not matter, it works for all “normal” dates.
Okay I understand. Then another question: Did you try “YYYY-ww”?
Y would give you the “week year” while y gives you “year” only … maybe you get “2021-01” then.
That’s it, thanks! You saved me a lot of pain