-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(mysql): DATE_ADD for datetimes #2360
Conversation
@@ -9775,7 +9775,7 @@ JOIN "date_dim" AS "d1" | |||
ON "catalog_sales"."cs_sold_date_sk" = "d1"."d_date_sk" | |||
AND "d1"."d_week_seq" = "d2"."d_week_seq" | |||
AND "d1"."d_year" = 2002 | |||
AND "d3"."d_date" > CONCAT("d1"."d_date", INTERVAL '5' day) | |||
AND "d3"."d_date" > "d1"."d_date" + INTERVAL '5' day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this change caught a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @barakalon, these date/time optimizations look really interesting. I wonder if they are valid in all supported dialects though? Date/time stuff can vary wildly...
Left a few comments to consider.
Yeah, I also am unsure of all the different nuances of different dialects. |
The recent logic I added for transpiling DATE_ADD in MySQL was wrong.
MySQL's DATE_ADD semantics are different than Hive's: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add
I'm not sure of a good way to handle this at the parser/generator level without a bunch of new TsOrDs* functions. So I added it to the optimizer for now.