jackwener commented on issue #4267:
URL: 
https://github.com/apache/arrow-datafusion/issues/4267#issuecomment-1319545030

   let me explain why.
   
   Due to global-state exists, we can't just optimize a subtree, we must 
traverse the whole tree.
   
   In fact, I prefer to `Pattern-match`, we match a subtree `pattern`, and just 
optimize the pattren/subtree.
   
   A example: Merge Limit
   
   ```rust
   match plan {
        Limit =>  {
              match childPlan => {
                 Limit => {  merge(limit, childlimit)  }
                  _ => { don't match pattern, return None or recurse....}
              }
        }
        _ => { don't match pattern, return None or recurse....}
   }
   ```
   
   we just match `limit-limit`, and handle it.
   
   BUT, global-state force we must handle various situations, and we must 
traverse the tree all.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to