-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bug with intervals and logical and/or #3944
Comments
I am not sure whether this is a bug in sql-parser, cc @andygrove . This is what I get ❯ select interval '5 days' > interval '3 days';
NotImplemented("Unsupported interval argument. Expected string literal, got: BinaryOp { left: Value(SingleQuotedString(\"5 days\")), op: Gt, right: Interval { value: Value(SingleQuotedString(\"3 days\")), leading_field: None, leading_precision: None, last_field: None, fractional_seconds_precision: None } }")
❯ select (interval '5 days') > interval '3 days';
+-----------------------------------------------------------------+
| IntervalDayTime("21474836480") > IntervalDayTime("12884901888") |
+-----------------------------------------------------------------+
| true |
+-----------------------------------------------------------------+
1 row in set. Query took 0.006 seconds. |
Looks very similar to |
|
This turned out to just be an error with the data file I was working with. Everything seems to work as expected now. |
I actually think this issue is not yet actually "fixed" in datafusion as we haven't updated the sqlparser version to 0.28 which includes the change. I will do so later today so reopening this issue |
This is fixed -- I have a PR open to add some regression test coverage: #4569 |
Describe the bug
While reviewing #3408, I found an additional error when trying to evaluate
select i_item_desc from test where d3_date > d1_date + INTERVAL '5 days' and d2_date > d1_date + INTERVAL '3 days'
:Error: NotImplemented("Unsupported interval argument. Expected string literal, got: BinaryOp { left: Value(SingleQuotedString(\"5 days\")), op: And, right: BinaryOp { left: Identifier(Ident { value: \"d2_date\", quote_style: None }), op: Gt, right: BinaryOp { left: Identifier(Ident { value: \"d1_date\", quote_style: None }), op: Plus, right: Interval { value: Value(SingleQuotedString(\"3 days\")), leading_field: None, leading_precision: None, last_field: None, fractional_seconds_precision: None } } } }")
To Reproduce
Here is the full code which should reproduce the error:
Expected behavior
Return the expected output with any errors.
Additional context
In my example,
data.csv
contains:The text was updated successfully, but these errors were encountered: