alamb commented on code in PR #13986: URL: https://github.com/apache/datafusion/pull/13986#discussion_r1901304742
########## datafusion/physical-plan/src/execution_plan.rs: ########## @@ -110,6 +110,16 @@ pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync { /// trait, which is implemented for all `ExecutionPlan`s. fn properties(&self) -> &PlanProperties; + /// Returns an error if this individual node does not conform to its invariants. + /// These invariants are typically only checked in debug mode. + /// + /// A default set of invariants is provided in the default implementation. + /// Extension nodes can provide their own invariants. + fn check_node_invariants(&self) -> Result<()> { + // TODO Review Comment: In the logical planner we have a split between * [`AnalyzerRule`](https://docs.rs/datafusion/latest/datafusion/optimizer/trait.AnalyzerRule.html)s that make plans Executable (e.g. by coercing types, etc) * [`OptimizerRule`](https://docs.rs/datafusion/latest/datafusion/optimizer/trait.OptimizerRule.html)s that don't change the plan semantics (e.g. output types are the same, etc) It seems like maybe we could make the same separation for physical optimizer rules as well ("not yet executable") and ("read to execute"), > Some take invalid plans and yield still invalid plans (IIRC JoinSelection is this way). These are typically applied early in the optimization/plan construction process. This was surprising to me (I am not doubting it). It looked at the other passes, and it seems there are a few others https://github.com/apache/datafusion/blob/264f4c51fc97981435f1a1827de934472d60edf8/datafusion/core/src/physical_optimizer/optimizer.rs#L56-L72 🤔 -- 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