avantgardnerio commented on code in PR #3287:
URL: https://github.com/apache/arrow-datafusion/pull/3287#discussion_r957674147
##########
datafusion/optimizer/src/decorrelate_scalar_subquery.rs:
##########
@@ -173,20 +191,28 @@ fn optimize_scalar(
.map_err(|e| context!("Exactly one input is expected. Is this a
join?", e))?;
let aggr = Aggregate::try_from_plan(sub_input)
.map_err(|e| context!("scalar subqueries must aggregate a value", e))?;
- let filter = Filter::try_from_plan(&aggr.input).map_err(|e| {
- context!("scalar subqueries must have a filter to be correlated", e)
- })?;
+ let filter = Filter::try_from_plan(&aggr.input).ok();
+
+ // if there were filters, we use that logical plan, otherwise the plan
from the aggregate
+ let input: &LogicalPlan;
Review Comment:
```suggestion
let input = if filter.is_some() {
input = &filter.unwrap().input;
} else {
input = &aggr.input;
};
```
--
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]