Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/18931
  
    @cloud-fan Thanks for comment.
    
    The basic idea is, for example, when we have a query plan looks like:
    
        Op1Exec
          Op2Exec
            Op3Exec
    
    Now we generate codes generally like:
    
        while (...) {
          ... // logic of Op3Exec's consume
          ... // logic of Op2Exec's consume
          ... // logic of Op1Exec's consume
        }
    
    This change goes to put the consume code of Op2Exec/Op1Exec into separated 
functions:
    
        while (...) {
          ... // logic of Op3Exec.
          boolean continueForLoop = Op2Exec_doConsume(...);
          if (continueForLoop) continue;
        }
        private boolean Op2Exec_doConsume(...) {
          ... // logic of Op2Exec to consume rows.
         boolean continueForLoop = Op1Exec_doConsume(...);
          if (continueForLoop) return true;
          return false;
        }
        private boolean Op1Exec_doConsume(...) {
          ... // logic of Op1Exec to consume rows.
          return false;
        }
    
    There are two issues needed to take care:
    
    1. The operator to put consume logic into a function can't defer variable 
evaluation. And can't use row variable in its consume.
    2. Maintain the effect of `continue` statements in the functions.
    
    
        


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to