comphead commented on code in PR #26544: URL: https://github.com/apache/datafusion/pull/26544#discussion_r4338795577
########## datafusion/sqllogictest/test_files/subquery.slt: ########## @@ -3627,3 +3627,45 @@ DROP TABLE unnest_outer; statement ok DROP TABLE unnest_inner; + +# An aggregate over a correlated scalar aggregate stays correlated. +# https://github.com/apache/datafusion/issues/26508 +statement ok +CREATE TABLE nested_agg_outer(k INT) AS VALUES (1), (2); + +statement ok +CREATE TABLE nested_agg_inner(id INT, v INT) AS VALUES (1, 10); + +# Expected `(1, 1), (2, 1)` and `(1, 1), (2, 0)`. +statement error DataFusion error: This feature is not implemented: Physical plan does not support logical expression ScalarSubquery +SELECT o.k, (SELECT count(*) FROM (SELECT max(i.v) FROM nested_agg_inner AS i WHERE i.id = o.k)) FROM nested_agg_outer AS o ORDER BY o.k; + +statement error DataFusion error: This feature is not implemented: Physical plan does not support logical expression ScalarSubquery +SELECT o.k, (SELECT max(n) FROM (SELECT count(*) AS n FROM nested_agg_inner AS i WHERE i.id = o.k)) FROM nested_agg_outer AS o ORDER BY o.k; + +# IN and LATERAL. Expected `2` and `(1, 1), (2, 0)`. Review Comment: Added both. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
