-
Notifications
You must be signed in to change notification settings - Fork 157
Return double with correct precision for UNIX_TIMESTAMP
#3679
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
Conversation
Signed-off-by: Yuanchun Shen <[email protected]>
…ut Calcite Signed-off-by: Yuanchun Shen <[email protected]>
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.
Just wondering how did we decide to fix these cases one by one instead of adding an implicit conversion from String to Timestamp?
+1. @yuancu I have mentioned it multiple times, could you make it happen before 3.1.0? We'd better not to extend original function definitions. For this case, the timestamp string should implicitly cast to timestamp instead of date. |
Do you mean when we find a type mismatch, we coerce it to timestamp instead of date? |
It depends on what the format of string is. |
Ok I get it. I'll try to fix it. Update: The functions are resolved based on the distance between input argument types and expected argument types. TODO:
|
…on without Calcite" This reverts commit c0f2e7b. Signed-off-by: Yuanchun Shen <[email protected]>
… function" This reverts commit 6937c9b. Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
@yuancu could your resolve the conflicts? |
No problem. |
Signed-off-by: Yuanchun Shen <[email protected]>
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.
LGTM, waiting CI pass
Signed-off-by: Yuanchun Shen <[email protected]>
@yuancu Do we have issue to track supporting implicit type coercion in v3? If not, please create a one and attach the ignored test there. |
Description
When
UNIX_TIMESTAMP
is fed with a timestamp string, it could not return a correct double value since the string is implicitly cast to date before feeding to the function.I reordered the signatures of
UNIX_TIMESTAMP
so thatunix_timestamp(timestamp)
will be prioritized when the input is a string. In such case, the string will be cast to a timestamp. The reordering is valid since this coercion should also be compatible with date and time types and will result in correct values for these types.Related Issues
Resolves #3611
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.