adriangb commented on code in PR #15779: URL: https://github.com/apache/datafusion/pull/15779#discussion_r2059092200
########## datafusion/physical-expr-common/src/physical_expr.rs: ########## @@ -333,6 +333,15 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug + DynEq + DynHash { // This is a safe default behavior. Ok(None) } + + /// Adapt this [`PhysicalExpr`] to a new schema. + /// For example, `Column("b", 1)` can be adapted to `Column("b", 0)` + /// given the schema `Schema::new(vec![("b", DataType::Int32)])`. + fn with_schema(&self, _schema: &Schema) -> Result<Option<Arc<dyn PhysicalExpr>>> { Review Comment: Sure would love to see a PR with your suggestion that accomplishes what this one does! Fundamentally, if I understand your proposal correctly, I would suggest splitting into something like: ```rust trait ExecutionPlan { fn update_expression_for_input_schema(&self, expr: Arc<dyn PhysicalExpr>) -> Arc<dyn PhysicalExpr> { expr.with_schema(self.input.schema()) } fn update_expression_for_output_schema(&self, expr: Arc<dyn PhysicalExpr>) -> Arc<dyn PhysicalExpr> { expr.with_schema(self.schema()) } ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org