Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.0.0
-
Any (MacOS 10.15.6)
Description
Negative numbers in SQL WHERE clauses are not parsed correctly:
```
> create external table blogs stored as PARQUET location '../../testing/data/parquet/generated_simple_numerics/blogs.par0 rows in set. Query took 0 seconds.
> select reply, blog_id from blogs where blog_id >= -1000;
InternalError("SQL binary operator cannot be interpreted as a unary operator")
```
The above can be seen with different data files, and with both integer and floating point negative numbers. The exception comes from planner.rs sql_to_rex() function, in the UnaryOp case, so it is data independent. jorgecarleitao seems you have made commits here, WDYT?
I'm not sure if the problem is SQLParser itself but the fix seems quite easy, basically to parse this:
UnaryOp { op: Minus, expr: Value(Number("1")) }
It can be seen in latest master also.
I'm up for contributing a fix if this is confirmed as a bug.
Attachments
Issue Links
- links to