-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support correlated scalar subquery without aggregation #16137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
datafusion/datafusion/expr/src/logical_plan/invariants.rs Lines 174 to 201 in 34f250a
DataFusion tries to predict maximum rows possible instead of actually checking the number of rows. DuckDB used to fix this by limiting the number of rows to one, now they have changed the behaviour to pass error by using something like
I tried using limit and got > WITH src AS (
SELECT *
FROM (VALUES
(1, NULL, 'Europe'),
(2, 1, 'Warsaw'),
(3, 1, 'Paris')
) t(id, parent_id, name)
)
SELECT
id,
name,
(SELECT p.name FROM src p WHERE p.id = s.parent_id limit 1) AS parent_name
FROM src s;
This feature is not implemented: Physical plan does not support logical expression ScalarSubquery(<subquery>) which is weird to say the least. I do not understand why just adding a limit will make it different. |
Is your feature request related to a problem or challenge?
This is perfectly valid use of scalar subquery without aggregation.
This should work in DataFusion
Currently this fails with
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
Expr::ScalarSubquery
) does not fail when subquery is not scalar #16134The text was updated successfully, but these errors were encountered: