erratic-pattern commented on code in PR #10386: URL: https://github.com/apache/datafusion/pull/10386#discussion_r1598743959
########## datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs: ########## @@ -1670,17 +1734,106 @@ fn inlist_except(mut l1: InList, l2: InList) -> Result<Expr> { Ok(Expr::InList(l1)) } +pub struct RewriteCycle { + consecutive_unchanged_count: usize, + total_iterations: usize, + num_rewriters: usize, +} +pub type RewriteCycleResult = ControlFlow<Result<Expr>, Expr>; + +impl RewriteCycle { + fn new() -> Self { + RewriteCycle { + // use usize::MAX as default to avoid checking null in is_done() comparison Review Comment: > I think modeling this with `num_rewriters: Option<usize>` would make it clearer what is going on and help the compiler check the logic yes I tried to get too fancy here with micro-optimizations when I saw benchmark regressions 😆 -- 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