Skip to content
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

date_part does't work for now() #3096

Closed
Tracked by #3148
waitingkuo opened this issue Aug 10, 2022 · 4 comments · Fixed by #4548
Closed
Tracked by #3148

date_part does't work for now() #3096

waitingkuo opened this issue Aug 10, 2022 · 4 comments · Fixed by #4548
Labels
bug Something isn't working

Comments

@waitingkuo
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

select date_part('hour', now());
Plan("Coercion from [Utf8, Timestamp(Nanosecond, Some(\"UTC\"))] to the signature OneOf([Exact([Utf8, Date32]), Exact([Utf8, Date64]), Exact([Utf8, Timestamp(Second, None)]), Exact([Utf8, Timestamp(Microsecond, None)]), Exact([Utf8, Timestamp(Millisecond, None)]), Exact([Utf8, Timestamp(Nanosecond, None)])]) failed.")

note that it could be fixed by

select date_part('hour', now()::timestamp);
+-------------------------------------------------------------------+
| datepart(Utf8("hour"),CAST(now() AS Timestamp(Nanosecond, None))) |
+-------------------------------------------------------------------+
| 6                                                                 |
+-------------------------------------------------------------------+
1 row in set. Query took 0.000 seconds.

the reason for that is now() output timestamp with time zone, but our date_part doesn't work for it

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

@waitingkuo waitingkuo added the bug Something isn't working label Aug 10, 2022
@waitingkuo
Copy link
Contributor Author

extract has the same behavior

select extract(hour from now());
Plan("Coercion from [Utf8, Timestamp(Nanosecond, Some(\"UTC\"))] to the signature OneOf([Exact([Utf8, Date32]), Exact([Utf8, Date64]), Exact([Utf8, Timestamp(Second, None)]), Exact([Utf8, Timestamp(Microsecond, None)]), Exact([Utf8, Timestamp(Millisecond, None)]), Exact([Utf8, Timestamp(Nanosecond, None)])]) failed.")

❯ select extract(hour from now()::timestamp);
+-------------------------------------------------------------------+
| datepart(Utf8("HOUR"),CAST(now() AS Timestamp(Nanosecond, None))) |
+-------------------------------------------------------------------+
| 6                                                                 |
+-------------------------------------------------------------------+
1 row in set. Query took 0.000 seconds.

@turbo1912
Copy link
Contributor

Hello @waitingkuo, is anyone working on this? If not I can try this one (maybe this is even fixed with some of the other recent timestamp fixes)

@waitingkuo
Copy link
Contributor Author

waitingkuo commented Aug 19, 2022

@turbo1912 i'm not working on this yet. It's not fixed yet, we could only cast Timestamp(Nanosecond, Some(\"UTC\") to Timestamp(Nanosecond, None) for now. I'd be great if you can help ❤️

@comphead
Copy link
Contributor

comphead commented Dec 7, 2022

@waitingkuo I'd pick this up if no objections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants