-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
decorrelate_where_in currently only support Predicate as the top level plan in the sub-queries, otherwise it will return an error:
https://github.com/apache/arrow-datafusion/blob/667f19ebad216b7592af5a91b70a24fb21c3bb64/datafusion/optimizer/src/decorrelate_where_in.rs#L151-L152
However, for limit subquery, the top level plan might be Limit which let decorrelate_where_in fail.
To Reproduce
Set skip_failed_rules to false and run the test support_limit_subquery, you will fail on the test with the error message
Error: Context("decorrelate_where_in", Internal("Optimizer rule 'decorrelate_where_in' failed due to unexpected error: a projection is required at datafusion/optimizer/src/decorrelate_where_in.rs:152\ncaused by\nError during planning: Could not coerce into Projection! at datafusion/expr/src/logical_plan/plan.rs:1293"))
test sql::subqueries::support_limit_subquery ... FAILED
Expected behavior
No error should be generated. At least, we can let decorrelate_where_in return Ok(None)
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working