aprimadi commented on issue #6179:
URL:
https://github.com/apache/arrow-datafusion/issues/6179#issuecomment-1530815784
# Background
AFAIK, currently filter expressions can occur in three types of LogicalPlan:
TableScan, Filter, and Join. In Join LogicalPlan, expressions can occur in
either ON clause or optional FILTER clause but the current expr simplifier rule
doesn't have any context of where the expression occurs, i.e. we want to
optimize `FILTER` expr in Join logical plan but not in `ON` clause. So I
propose to add ExprContext that can be passed to the expr simplifier.
# Proposed API Change
I think this requires adding an ExprContext struct which has the following
fields:
```rust
pub struct ExprContext {
in_filter: bool,
}
```
And also change `LogicalPlan::inspect_expressions` to take a function as an
argument that has the following signature:
```rust
F: FnMut(&Expr, ExprContext) -> Result<(), E>
```
And add another public API to LogicalPlan with the following function
signature:
```rust
pub fn expressions_with_context(self: &LogicalPlan) -> Vec<(Expr,
ExprContext)>
```
# Alternative
Since OptimizerRule takes LogicalPlan as input, perhaps we don't need to
modify/add public LogicalPlan API and keeps the implementation detail
encapsulated in `SimplifyExpressions`.
--
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]