alamb commented on code in PR #3578:
URL: https://github.com/apache/arrow-datafusion/pull/3578#discussion_r982843446
##########
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 see -- thanks -- I checked those rewrites and
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3b41b0409c8ecf4df0027f323668e0db
they do look good to me
##########
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.
+// extract at least one qual of each sub clauses of OR clause, then form the
quals
+// to new OR clause as predicate.
+//
+// Filter: (a = c and a < 20) or (b = d and b > 10)
+// join/crossjoin:
+// TableScan: projection=[a, b]
+// TableScan: projection=[c, d]
+//
+// is optimized to
+//
+// Filter: (a = c and a < 20) or (b = d and b > 10)
+// join/crossjoin:
+// Filter: (a < 20) or (b > 10)
+// TableScan: projection=[a, b]
+// TableScan: projection=[c, d]
+fn extract_or_clauses_for_join(
Review Comment:
```suggestion
// TableScan: projection=[c, d]
//
// In general, predicates of this form:
//
// (A AND B) OR (C AND D)
//
// will be transformed to
//
// ((A AND B) OR (C AND D)) AND (A OR C)
//
// OR
//
// ((A AND B) OR (C AND D)) AND ((A AND B) OR C)
//
// OR
//
// do nothing.
//
fn extract_or_clauses_for_join(
```
--
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]