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
Implement formatDateTime function #2770
Implement formatDateTime function #2770
Conversation
A subset of Locale dependent formatting shouldn't be supported for now.
The same way as it is used in
It will consider optional argument with explicit time zone:
or time zone, embedded in the data type of the first argument:
That is the server time zone by default.
Look at methods:
In your case, you will And you don't need to implement a separate branch in code. |
@alexey-milovidov , I've implemented missing formats, but faced performance problems (my implementation has weaker performance, comparing to reference query, you've provided in #2818):
For my implementation:
It is up to you to decide, whether #2818 should be merged, or I should try to optimize this one. |
We've just planned to polish this PR (or #2818), |
There are four reasons why the code is slow:
|
Thanks, @alexey-milovidov , will apply changes. |
@alexey-milovidov , here are results after optimization:
New implementation:
There is one issue, and one question. Question: I've implemented support only for DateTime input parameter, whereas Date is not implemented. It can be easily templated, and so on, but here comes the question what behavior we expect for non-supported by Date formatting? E.g. do we expect client to receive this exception:
When query:
Or we would convert date to date + 00:00:00 ? |
That's much better!
Just leave it unimplemented (throw exception) and we will have a chance to implement later.
I think, the user will expect that we use zeros as time (format Date in the same way as DateTime). |
I have started to merge. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
In this PR I will add support for formatDateTime function. But to proceed, I need several comments: