-
Notifications
You must be signed in to change notification settings - Fork 594
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
feat(expr): support interval to_char()
#14071
Conversation
cc7fb7a
to
c20b0f6
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #14071 +/- ##
==========================================
- Coverage 67.99% 67.88% -0.11%
==========================================
Files 1554 1554
Lines 268874 269076 +202
==========================================
- Hits 182819 182670 -149
- Misses 86055 86406 +351
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Is there any pg regress tests for it? 🤔
Good point! will check. |
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 for the code. I don't check the format.
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.
Generally LGTM
Unfortunately, no available regress tests for us, the tests are either for |
Co-authored-by: Kexiang Wang <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
To solve #13561
Postgres' corresponding doc here.
In Postgres, an interval is first converted to a timestamp, and then use timestamp's
to_char()
implementation to convert the interval to a char. Butchrono
doesn't support interval type, especially negative intervals.To reuse the format parsing implementation of
chrono
, in this PR, we still first convert the template tochrono
template, and then format the interval based on the theItem
types and the corresponding behaviors in Postgres.In the test file, you may see some output really wired. For example,
I have to say the implementation of postgres is not prudent and unified among different
Item
s. Here, I choose to strictly follow their behaviors.Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.
to_char
Converts the input to string according to the given format. Both uppercase and lowercase formats are supported.