MaxGekk commented on a change in pull request #25230: [SPARK-28471][SQL] Replace `yyyy` by `uuuu` in date-timestamp patterns without era URL: https://github.com/apache/spark/pull/25230#discussion_r307179978
########## File path: sql/core/src/test/resources/sql-tests/results/pgSQL/date.sql.out ########## @@ -520,7 +520,7 @@ select make_date(-44, 3, 15) -- !query 48 schema struct<make_date(-44, 3, 15):date> -- !query 48 output -0045-03-15 +-0044-03-15 Review comment: Yes, our current answer is `45` which is `45 BC`... but because we skip the era field in our pattern, it is just `45` or `45 CE` (current era by default). That's wrong as well. So, correct answer must include either **positive year + era** or **year with sign (-)**. PostgreSQL choose the first approach but it converts year incorrectly. I have proposed in this PR the second approach because it allows to maintain only one pattern (`uuuu` instead of `yyyy`). The first approach requires dynamically switching to the pattern with era only for negative years. I don't think it is worth, especially when SQL standard tells us that years must be in the range `[0001, 9999]`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
