-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: support date - timestamp
and timestamp - date
#5960
Conversation
24fbb70
to
908055e
Compare
@@ -88,3 +88,19 @@ h | |||
statement error DataFusion error: Error during planning: Timestamp\(Nanosecond, Some\("\+00:00"\)\) \+ Utf8 can't be evaluated because there isn't a common type to coerce the types to | |||
select i_item_desc from test | |||
where d3_date > now() + '5 days'; | |||
|
|||
# DATE minus DATE |
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 have a idea, maybe we can add a type_coercion.slt.
I prepare to add it in next PR.
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.
Great, btw we already have array_typeof.slt
which also covers some casts
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.
Thank you @jackwener, LGTM. @berkaysynnada can chime in if there is anything I'm missing
date - timestamp
and timestamp - date
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.
Thanks @jackwener and @comphead
0 years 0 mons 0 days 0 hours 0 mins 0.000000000 secs | ||
|
||
# large timestamp - small timestamp | ||
# Todo: Does it need to be fixed for negative values?. |
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 think negative values is correct and a valid interval. The intervals are signed according to the arrow spec:
@@ -754,51 +751,6 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTyp | |||
} | |||
} | |||
|
|||
/// Coercion rule for numerical types: The type that both lhs and 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.
it is always nice to see a bug fixed by deleting code. Thank you @jackwener 👏
Thanks everyone❤️ |
Which issue does this PR close?
Closes #5931 .
Rationale for this change
support data/timestamp minus in type coercion.
What changes are included in this PR?
Add test in slt.
Are these changes tested?
Are there any user-facing changes?