You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Correlated scalar subquery with a non-equality predicate fails with a schema error over a renamed column #27691
I opened #27783 for the schema error. When a correlated filter is pulled up above a join inside the subquery, the join kept its old schema, so the column the filter reads was missing. With the fix, the same shape with an equality predicate (for example WHERE a = o.a) returns correct results for scalar, EXISTS, NOT EXISTS and IN subqueries.
For the query in this issue, the result after the fix is This feature is not implemented: Physical plan does not support logical expression ScalarSubquery(<subquery>), not 0. The predicate e.x < o.a is a non-equality correlated predicate, and DataFusion does not decorrelate correlated scalar subqueries with such predicates yet (see #non_equal_correlated_scalar_subquery in subquery.slt).
I also tried the two variants from the description on current main, without the rename and without the join. Both fail with the same not implemented error, so the rename and the join only change which error you get first.
Activity
tlfua commentedon Nov 26, 2026
take
tlfua commentedon Nov 27, 2026
Thanks for the report and the clear reproducer.
I opened #27783 for the schema error. When a correlated filter is pulled up above a join inside the subquery, the join kept its old schema, so the column the filter reads was missing. With the fix, the same shape with an equality predicate (for example
WHERE a = o.a) returns correct results for scalar,EXISTS,NOT EXISTSandINsubqueries.For the query in this issue, the result after the fix is
This feature is not implemented: Physical plan does not support logical expression ScalarSubquery(<subquery>), not0. The predicatee.x < o.ais a non-equality correlated predicate, and DataFusion does not decorrelate correlated scalar subqueries with such predicates yet (see#non_equal_correlated_scalar_subqueryinsubquery.slt).I also tried the two variants from the description on current
main, without the rename and without the join. Both fail with the samenot implementederror, so the rename and the join only change which error you get first.fix: update join schema when pulling up correlated columns (apache#27783