lvheyang edited a comment on issue #723:
URL: 
https://github.com/apache/arrow-datafusion/issues/723#issuecomment-881143044


   Thank you @yordan-pavlov for your explanation! It's so kind of you. 
   
   And I did some other tests, I found some other unexpected behavior. SQL like:
   
   ```
   select c0, (250-c0) > 0 from foo
   
   select c0, (250-c0) > 0 from foo where (250-c0) > 0
   ```
   
   The first SQL return result:
   
   ```
   +--------------------+---------------------------------+
   | c0                 | Int64(250) Minus c0 Gt Int64(0) |
   +--------------------+---------------------------------+
   | 107.0090813093981  | true                            |
   | 125.51519138755981 | true                            |
   | 141.83342587451415 | true                            |
   | 113.65534481251639 | true                            |
   | 251.10794896957802 | false                           |
   | 112.08361695028363 | true                            |
   +--------------------+---------------------------------+
   ```
   
   
   We expected the second SQL to return 5 rows, but actually, it returns an 
empty set incorrectly.
   
   It is because the pruning predicate is built as: `(Int64(250) Minus #c0_max) 
> Int64(0)` which is also incorrect. The negative symbol before `col("c0")` 
should have reversed the predicate. So the right pruning predicate should be 
`(Int64(250) Minus #c0_min) > Int64(0)`
   
   I plan to go deeper into related code these days and try to find a way to 
fix it. However, I'm not very familiar with this part, it may cost some time. 
>_<


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to