timsaucer commented on code in PR #23622:
URL: https://github.com/apache/datafusion/pull/23622#discussion_r3595135374


##########
datafusion/core/src/physical_planner.rs:
##########
@@ -143,6 +143,35 @@ pub trait PhysicalPlanner: Send + Sync {
     ) -> Result<Arc<dyn PhysicalExpr>>;
 }
 
+/// A planner adapter that lowers expressions with the properties for the plan
+/// currently being built rather than the properties stored on the session.
+struct PhysicalPlannerWithProps<'a> {
+    inner: &'a dyn PhysicalPlanner,
+    execution_props: &'a ExecutionProps,
+}
+
+#[async_trait]
+impl PhysicalPlanner for PhysicalPlannerWithProps<'_> {
+    async fn create_physical_plan(
+        &self,
+        logical_plan: &LogicalPlan,
+        session_state: &SessionState,
+    ) -> Result<Arc<dyn ExecutionPlan>> {
+        self.inner
+            .create_physical_plan(logical_plan, session_state)
+            .await
+    }
+
+    fn create_physical_expr(
+        &self,
+        expr: &Expr,
+        input_dfschema: &DFSchema,
+        _session_state: &SessionState,
+    ) -> Result<Arc<dyn PhysicalExpr>> {
+        create_physical_expr(expr, input_dfschema, self.execution_props)
+    }

Review Comment:
   This is the key to this PR. By intercepting the calls to 
`create_physical_expr` and making sure they get the execution props we support 
the scalar subqueries instead of relying on getting them from the session, 
which in this PR no longer has the correct props.



-- 
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]

Reply via email to