askalt commented on code in PR #19985:
URL: https://github.com/apache/datafusion/pull/19985#discussion_r2725148726


##########
datafusion/physical-plan/src/projection.rs:
##########
@@ -313,19 +333,30 @@ impl ExecutionPlan for ProjectionExec {
         partition: usize,
         context: Arc<TaskContext>,
     ) -> Result<SendableRecordBatchStream> {
-        trace!(
-            "Start ProjectionExec::execute for partition {} of context 
session_id {} and task_id {:?}",
-            partition,
-            context.session_id(),
-            context.task_id()
-        );
-
+        // Take expressions and metrics from self.
         let projector = self.projector.with_metrics(&self.metrics, partition);
-        Ok(Box::pin(ProjectionStream::new(
+        let input = self.input.execute(partition, Arc::clone(&context))?;
+        Self::raw_execute(&self.metrics, projector, partition, input, &context)
+    }
+
+    fn execute_with(

Review Comment:
   In the case of `execute(...)` expressions and metrics are taken from `self`, 
when in the case of `execute_with(...)` they are taken from the passed context. 



##########
datafusion/physical-expr-common/src/physical_expr.rs:
##########
@@ -43,6 +43,21 @@ use itertools::izip;
 /// Shared [`PhysicalExpr`].
 pub type PhysicalExprRef = Arc<dyn PhysicalExpr>;
 
+/// Describes execution context for the particular expression.
+pub struct ExprExecutionContext {

Review Comment:
   Provides a context for the particular expression. 



##########
datafusion/physical-expr-common/src/physical_expr.rs:
##########
@@ -430,6 +445,15 @@ pub trait PhysicalExpr: Any + Send + Sync + Display + 
Debug + DynEq + DynHash {
     fn is_volatile_node(&self) -> bool {
         false
     }
+
+    /// Make this expression executable. The most expressions are executable 
and do not
+    /// require an additional work so this method could return `self`. 
However, there are
+    /// expressions that should be transformed prior to execution, e.g. 
placeholder that
+    /// should be resolved into scalar.
+    fn execute(

Review Comment:
   This way we allow to customize behavior for each particular expression (not 
only for dynamic filter or placeholder), so re-execution process could be 
supported for any user expression.



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