neilconway commented on code in PR #22530:
URL: https://github.com/apache/datafusion/pull/22530#discussion_r3305935348
##########
datafusion/common/src/config.rs:
##########
@@ -1124,6 +1124,13 @@ config_namespace! {
/// into the file scan phase.
pub enable_topk_dynamic_filter_pushdown: bool, default = true
+ /// When set to true, uncorrelated scalar subqueries are left in
+ /// the logical plan and executed by `ScalarSubqueryExec` during
physical
+ /// execution. When set to false, all scalar subqueries (including
+ /// uncorrelated ones) are rewritten to left joins by the
+ /// `ScalarSubqueryToJoin` optimizer rule.
+ pub physical_uncorrelated_scalar_subquery: bool, default = true
Review Comment:
The other similar config options use the phrasing `enable_...`; we should
probably adopt that for consistency.
`physical_uncorrelated_scalar_subquery` is also a mouthful, although I can't
immediately think of a more concise name that is also accurate.
##########
datafusion/sqllogictest/test_files/subquery.slt:
##########
@@ -2091,6 +2091,95 @@ SELECT (SELECT v FROM (SELECT 1 AS v UNION ALL SELECT 2)
AS t ORDER BY v LIMIT 1
----
1
+#############
+## End-to-end correctness coverage for the flag-off path.
+## When `datafusion.optimizer.physical_uncorrelated_scalar_subquery` is false,
+## uncorrelated scalar subqueries are rewritten to left joins by
+## `ScalarSubqueryToJoin` instead of executed by `ScalarSubqueryExec`. This
+## restores pre-PR-21240 behavior, which has three known shortcomings the
Review Comment:
I think you only list two known shortcomings?
##########
datafusion/optimizer/src/scalar_subquery_to_join.rs:
##########
Review Comment:
This comment needs updating.
--
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]