ygf11 commented on code in PR #4725:
URL: https://github.com/apache/arrow-datafusion/pull/4725#discussion_r1057088599
##########
datafusion/optimizer/src/subquery_filter_to_join.rs:
##########
@@ -108,13 +107,17 @@ impl OptimizerRule for SubqueryFilterToJoin {
};
let right_key =
right_schema.field(0).qualified_column();
- let left_key = match *expr.clone() {
- Expr::Column(col) => col,
- _ => return
Err(DataFusionError::NotImplemented(
- "Filtering by expression not implemented
for InSubquery"
- .to_string(),
- )),
- };
+ let left_key = *expr.clone();
+ let (on, filter) =
+ // When left is a constant expression, like 1,
+ // the join predicate will be `1 = right_key`,
it is better to add it to filter.
+ if left_key.to_columns()?.is_empty() {
+ let equi_expr =
+ Expr::eq(*expr.clone(),
Expr::Column(right_key));
+ (vec![], Some(equi_expr))
+ } else {
Review Comment:
> It could be better to handle separate/handle on/joinfilter in a new
rule(we also can add more improvement in it).
Agree.
There is another pr #4711 which will separate equi and non-equi predicate
from filter.
We can add the `left-key = right-key` to join-filter in this rule, and let
the other rule do the separating works.
--
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]