alamb commented on code in PR #3578:
URL: https://github.com/apache/arrow-datafusion/pull/3578#discussion_r979228223
##########
datafusion/optimizer/src/filter_push_down.rs:
##########
@@ -248,6 +249,128 @@ fn get_pushable_join_predicates<'a>(
.unzip()
}
+// examine OR clause to see if any useful clauses can be extracted and push
down.
Review Comment:
I don't think this transformation is correct. In particular, I don't think
the results will always be the same
Schematically, we have this type of predicate (that is being evaluated
during the join)
```
(A AND B) OR (C AND D)
```
This transformation proposes adding another `(A OR B)` clause (evaluated
before the join), so effectively
```
((A AND B) OR (C AND D)) AND (A OR B)
```
In order to do this transformation, the boolean statements must be
equivalent for all inputs.
However, a counter example is
```
A: false, B: false, C: true, D: true
```
In this case, the original predicate would be true, but the rewrite would be
false
Here is the program I wrote to generate the entire truth table:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=334938478775ba3cd55e7c400ea89b06
--
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]