-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Return Int for Date - Date instead of duration #19563
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
base: main
Are you sure you want to change the base?
Conversation
2b09623 to
c7de274
Compare
|
It seems to me that mapping the binary op's duration result to an int64 taking into account the timeunit and mod to get the day would be cleaner? |
Thanks of the feedback. |
c7de274 to
902bb07
Compare
| # Verify Date - Date returns Int64 type | ||
| query T | ||
| SELECT arrow_typeof(DATE '2023-04-09' - DATE '2023-04-02'); | ||
| ---- | ||
| Int64 |
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.
These tests seem duplicated with what we already have in arith_date_date.slt?
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.
they are, though the arith_* files came in after these tests existed and I didn't noticed until after that PR had merged.
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.
I will remove the duplicate test.
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
| // Special case: Date - Date should return Int64 (days difference) | ||
| // This aligns with PostgreSQL, DuckDB, and MySQL behavior | ||
| // See: https://www.postgresql.org/docs/current/functions-datetime.html | ||
| if matches!(self.op, Minus) && is_date_minus_date(lhs, rhs) { |
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.
This needs to be removed if the above suggestion was applied
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.
Yes, I forgot
Which issue does this PR close?
Rationale for this change
The Date - Date currently returns duration which is not consistent with other databases.
What changes are included in this PR?
Are these changes tested?
Yes
Are there any user-facing changes?