Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Nov 25, 2022
1 parent ae0b7cd commit ee5c9c7
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions datafusion/optimizer/src/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ impl OptimizerRule for PushDownFilter {
) -> Result<LogicalPlan> {
let filter = match plan {
LogicalPlan::Filter(filter) => filter,
// we also need to pushdown filter in Join.
LogicalPlan::Join(join) => {
let optimized_plan = push_down_join(plan, join, None)?;
return match optimized_plan {
Expand Down Expand Up @@ -1006,10 +1007,7 @@ mod tests {
\n Projection: test.a AS b, test.c\
\n TableScan: test"
);
// "Filter: SUM(test.c) > Int64(10) AND b > Int64(10)\
// \n Aggregate: groupBy=[[b]], aggr=[[SUM(test.c)]]\
// \n Projection: test.a AS b, test.c\
// \n TableScan: test"

// filter is before the projections
let expected = "\
Filter: SUM(test.c) > Int64(10)\
Expand Down Expand Up @@ -1226,8 +1224,7 @@ mod tests {
// not part of the test, just good to know:
assert_eq!(
format!("{:?}", plan),
"\
Filter: test.a <= Int64(1)\
"Filter: test.a <= Int64(1)\
\n Inner Join: test.a = test2.a\
\n TableScan: test\
\n Projection: test2.a\
Expand Down Expand Up @@ -1266,8 +1263,7 @@ mod tests {
// not part of the test, just good to know:
assert_eq!(
format!("{:?}", plan),
"\
Filter: test.a <= Int64(1)\
"Filter: test.a <= Int64(1)\
\n Inner Join: Using test.a = test2.a\
\n TableScan: test\
\n Projection: test2.a\
Expand Down Expand Up @@ -1310,8 +1306,7 @@ mod tests {
// not part of the test, just good to know:
assert_eq!(
format!("{:?}", plan),
"\
Filter: test.c <= test2.b\
"Filter: test.c <= test2.b\
\n Inner Join: test.a = test2.a\
\n Projection: test.a, test.c\
\n TableScan: test\
Expand Down Expand Up @@ -1349,8 +1344,7 @@ mod tests {
// not part of the test, just good to know:
assert_eq!(
format!("{:?}", plan),
"\
Filter: test.b <= Int64(1)\
"Filter: test.b <= Int64(1)\
\n Inner Join: test.a = test2.a\
\n Projection: test.a, test.b\
\n TableScan: test\
Expand Down Expand Up @@ -1769,8 +1763,7 @@ mod tests {
// not part of the test, just good to know:
assert_eq!(
format!("{:?}", plan),
"\
Full Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
"Full Join: test.a = test2.a Filter: test.a > UInt32(1) AND test.b < test2.b AND test2.c > UInt32(4)\
\n Projection: test.a, test.b, test.c\
\n TableScan: test\
\n Projection: test2.a, test2.b, test2.c\
Expand Down Expand Up @@ -1961,8 +1954,7 @@ mod tests {
// filter on col b
assert_eq!(
format!("{:?}", plan),
"\
Filter: b > Int64(10) AND test.c > Int64(10)\
"Filter: b > Int64(10) AND test.c > Int64(10)\
\n Projection: b, test.c\
\n Projection: test.a AS b, test.c\
\n TableScan: test\
Expand Down Expand Up @@ -1991,8 +1983,7 @@ mod tests {
// filter on col b and d
assert_eq!(
format!("{:?}", plan),
"\
Filter: b > Int64(10) AND d > Int64(10)\
"Filter: b > Int64(10) AND d > Int64(10)\
\n Projection: test.a AS b, test.c AS d\
\n TableScan: test\
"
Expand Down Expand Up @@ -2031,8 +2022,7 @@ mod tests {

assert_eq!(
format!("{:?}", plan),
"\
Inner Join: c = d Filter: c > UInt32(1)\
"Inner Join: c = d Filter: c > UInt32(1)\
\n Projection: test.a AS c\
\n TableScan: test\
\n Projection: test2.b AS d\
Expand Down Expand Up @@ -2066,8 +2056,7 @@ mod tests {
// filter on col b
assert_eq!(
format!("{:?}", plan),
"\
Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
"Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
\n Projection: test.a AS b, test.c\
\n TableScan: test\
"
Expand Down Expand Up @@ -2099,8 +2088,7 @@ mod tests {
// filter on col b
assert_eq!(
format!("{:?}", plan),
"\
Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
"Filter: b IN ([UInt32(1), UInt32(2), UInt32(3), UInt32(4)])\
\n Projection: b, test.c\
\n Projection: test.a AS b, test.c\
\n TableScan: test\
Expand Down

0 comments on commit ee5c9c7

Please sign in to comment.