-
Notifications
You must be signed in to change notification settings - Fork 829
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
Make Interval Parsing More Permissive #6390
Comments
I think |
The most likely scenario where it could come up is While we're talking about weird things postgres supports, as per apache/datafusion-sqlparser-rs#1345 (comment), the following are also supported: select interval '1 month + 2 day'
select interval '1 minute + 2 s' -- makes sense, all units are supported in arithmetic expressions
select interval '1 minute - 2 s'
select interval '1 minute + 2' -- makes sense since raw numbers are interpreted as seconds
select interval '1 minute * 2s' -- this is crazy! the "*" operator is interpretted as "+" so this evaluates as 0:01:02
select interval '1 minute * 2' -- same!
select interval '1 minute minute' -- repeated units are ignored
select interval '1 month + 2 day' day -- same thing with the units just concatenated |
@alamb do we have a plan on integrating this inside Arrow? |
I am not sure what you mean by this question @ByteBaker |
I meant to ask if we plan to handle more cases in our parsing logic? To be closer to parsing abilities of Postgres? As @samuelcolvin pointed out above. |
I guess in general I think it would be driven by contributor needs -- if someone wants needs more exotic parsing support, we can definitely consider it, but if it gets too specific, it probably makes sense to keep the parsing in the application and not in arrow-rs |
In that case we need to decide if we wanna keep this one open or not. |
Let's leave it open so it is easier to find if someone else hits the problem |
5 day hour
wrongly
Describe the bug
While working on apache/datafusion#12448 I noticed that the string
5 day hour
is not interpreted correctly byparse_interval_month_day_nano_config
, it should be considered the same as5 day 0 hour
, instead it return an error.To Reproduce
run that function, or look at apache/datafusion#12448
Expected behavior
parse_interval_month_day_nano_config
should match postgres behaviour in generalAdditional context
Related to #6211 where I improved interval parsing a lot, although apparently not enough.
The text was updated successfully, but these errors were encountered: