You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Evan Chan (Jira)" <ji...@apache.org> on 2020/11/27 22:18:00 UTC

[jira] [Created] (ARROW-10753) Negative numbers in SQL WHERE clause not parsed correctly

Evan Chan created ARROW-10753:
---------------------------------

             Summary: Negative numbers in SQL WHERE clause not parsed correctly
                 Key: ARROW-10753
                 URL: https://issues.apache.org/jira/browse/ARROW-10753
             Project: Apache Arrow
          Issue Type: Bug
          Components: Rust - DataFusion
    Affects Versions: 2.0.0
         Environment: Any (MacOS 10.15.6)
            Reporter: Evan Chan
             Fix For: 3.0.0


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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)