wiedld commented on code in PR #14329:
URL: https://github.com/apache/datafusion/pull/14329#discussion_r1931125532


##########
datafusion/expr/src/logical_plan/invariants.rs:
##########
@@ -41,19 +61,54 @@ pub enum InvariantLevel {
     Executable,
 }
 
+/// Apply the [`InvariantLevel::Always`] check at the root plan node only.
 pub fn assert_always_invariants(plan: &LogicalPlan) -> Result<()> {
     // Refer to 
<https://datafusion.apache.org/contributor-guide/specification/invariants.html#relation-name-tuples-in-logical-fields-and-logical-columns-are-unique>
     assert_unique_field_names(plan)?;
 
     Ok(())
 }
 
+/// Visit the plan nodes, and confirm the [`InvariantLevel::Executable`]
+/// as well as the less stringent [`InvariantLevel::Always`] checks.
 pub fn assert_executable_invariants(plan: &LogicalPlan) -> Result<()> {

Review Comment:
   The does feel like a blurring of definitions. The previous decision was made 
based upon minimizing the performance impact; at the time, we wanted the 
"always" invariants to be be cheap and able to be checked more frequently.
   
   However, as of now the frequency is:
   * LP always invariants checked before analyzer
   * LP executable (including always) invariants checked:
       * after analyzer
       * once before all optimizer runs
       * once after all optimizer runs
   
   Should I undo this blurring, and have the `assert_always_invariants` also be 
recursive?



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

Reply via email to