berkaysynnada commented on PR #15566: URL: https://github.com/apache/datafusion/pull/15566#issuecomment-2796620968
Here is a join example: assuming this initial plan: ``` - FilterExec: [a@0 = foo, a@0 > x@1] - Join: [schema: {left: a@0, right: x@0}, filter: {x@0 is even AND a@0 < x@0 + 10}] - DataSource: [a] - DataSource: [x] ``` The rule is shaped like that from my pseudo docs: ```rust context.transform_down(|node| { let FilterPushdownResult { child_filters, remaining_filters, operator } = node.plan.try_pushdown_filters(node.data)?; if remaining_filters.is_empty() { for child_index in 0..self.children.len { node.children[child_index].data = child_filters[child_index]; } return Ok(Transformed::yes(node)); } else { node.plan = FilterExec::try_new(predicate: remaining_filters, input: node.plan); node.children = [node.clone().clear_node_data()]; node.data = Default::default(); } }) ``` 1st iteration on FilterExec: ``` child_filters: [[a@0 = foo, a@0 = x@1]] remaining_filters: [] operator: Join… if condition comes up true ⇒ Join node has [a@0 = foo, a@0 > x@1] as the node data ``` 2nd iteration on JoinExec: ``` child_filters: [[a@0=foo], [x@0 is even]] remaining_filters: [] operator: Join: [schema: {left: a@0, right: x@0}, filter: {a@0 > x@1 AND a@0 < x@0 + 10}] if condition comes up true ⇒ LeftDataSource node has [a@0 = foo], RightDataSource node has [x@0 is even] as the node data ``` 3rd iteration on LeftDataSource ``` child_filters: [[]] remaining_filters: [] operator: LeftDataSource: filter: [a@0 = foo] ``` 4th iteration on RightDataSource ``` child_filters: [[]] remaining_filters: [] operator: LeftDataSource: filter: [x@0 is even] ``` PS. I’m not considering dynamic filters in this example -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org