kumarUjjawal commented on code in PR #22736:
URL: https://github.com/apache/datafusion/pull/22736#discussion_r3353837019
##########
datafusion/core/src/physical_planner.rs:
##########
@@ -442,15 +474,30 @@ impl DefaultPhysicalPlanner {
// scalar subqueries to joins, so none should reach this point.
// Skip collection in that case to avoid creating a no-op
// `ScalarSubqueryExec` wrapper.
- let all_subqueries = if session_state
+ if !session_state
.config_options()
.optimizer
.enable_physical_uncorrelated_scalar_subquery
{
- Self::collect_scalar_subqueries(logical_plan)
+ return self
+ .create_initial_plan_inner(logical_plan, session_state)
+ .await;
+ }
+
+ let mut all_subqueries =
Self::collect_scalar_subqueries(logical_plan);
+ let freshened = if
all_subqueries.iter().any(Subquery::is_volatile) {
+ Some(Self::freshen_volatile_subqueries(logical_plan)?)
} else {
- Vec::new()
+ None
};
+ let logical_plan = match &freshened {
+ Some(freshened) => {
+ all_subqueries =
Self::collect_scalar_subqueries(freshened);
+ freshened
+ }
+ None => logical_plan,
+ };
Review Comment:
Thank you @neilconway for great feedback as always. I have tried to address
the concerns please check.
--
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]