wiedld commented on code in PR #14329: URL: https://github.com/apache/datafusion/pull/14329#discussion_r1936635870
########## datafusion/expr/src/logical_plan/extension.rs: ########## @@ -54,6 +57,22 @@ pub trait UserDefinedLogicalNode: fmt::Debug + Send + Sync { /// Return the output schema of this logical plan node. fn schema(&self) -> &DFSchemaRef; + /// Return the list of invariants. + /// + /// Implementing this function enables the user to define the + /// invariants for a given logical plan extension. + fn invariants(&self) -> Vec<Invariant> { + vec![] + } + + /// Perform check of invariants for the extension node. + fn check_invariants(&self, check: InvariantLevel, plan: &LogicalPlan) -> Result<()> { Review Comment: Yeah, having both only makes sense when considering the next step of having a user define an `Invariant` which can be run on any LogicalPlan node. The user provides this abstraction: ``` pub struct Invariant { pub kind: InvariantLevel, pub fun: InvariantFn, } ``` for either for a their own extension node. Or to the session context to run on any builtin Logical Plan node. However, if we are not going to do this follow up bit -- then yes, I can consolidate it to only the single `fn check_invariants()` method. Please lmk. 🙏🏼 -- 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