-
Notifications
You must be signed in to change notification settings - Fork 314
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
Improve interval expression #4168
Comments
Hi Dennis @killme2008 If that's the case is there any established way of "intercepting" the AST before sending it to plan? |
I think we can transform the https://github.com/GreptimeTeam/greptimedb/blob/main/src/sql/src/statements/transform/type_alias.rs Adds a new transform rule and add it to
|
@etolbakov Looks like compound signed number case not processed properly: mysql> SELECT INTERVAL '-1h5m';
+----------------------------------------------+
| IntervalMonthDayNano("18446740773709551616") |
+----------------------------------------------+
| P0Y0M0DT0H-55M0S |
+----------------------------------------------+
mysql> SELECT INTERVAL '-1h-5m';
ERROR 1815 (HY000): Failed to plan SQL: Parser error: Invalid input syntax for type interval: "-1 h- 5 minutes" Would you like to fix it? |
ohhh....my bad, yeah, let me give it a go |
I have crafted a document detailing the |
@etolbakov I have an idea. Maybe we can apply this transform rule to the https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.Expr.html#variant.Cast https://docs.rs/datafusion/latest/datafusion/logical_expr/struct.TryCast.html |
It's a great idea! Let me make an assessment (and reopen the ticket 😁) |
What type of enhancement is this?
API improvement, User experience
What does the enhancement do?
GreptimeDB supports sql-compatible intervals like:
That is great. But in many time-series query scenarios, the
1 hour
is shortened to1h
. It is great to support it too:Other units such as:
y
for yearsm
for minutess
for secondsw
for weeksd
for daysetc.
Implementation challenges
No response
The text was updated successfully, but these errors were encountered: