alamb opened a new pull request, #7747:
URL: https://github.com/apache/arrow-datafusion/pull/7747

   ## Which issue does this PR close?
   
   Related to https://github.com/apache/arrow-datafusion/pull/7699
   
   ## Rationale for this change
   
   I am somewhat embarrassed that I did not fully understand @Dandandan 's fix 
in https://github.com/apache/arrow-datafusion/pull/7699/files and then spent 
some non trivial time tracking the same issue down in IOx and filed a ticket 
https://github.com/apache/arrow-datafusion/issues/7746 only to find it had 
already been fixed
   
   ## What changes are included in this PR?
   Add some comments to try and explain the change more generally
   
   BTW I made a diagram explaining what is going on, that I wanted to share 
even though I am not sure it belongs in the comments directly:
   
   ```
    Query:                                                                      
                                           
    SELECT t.a FROM t WHERE t.b > 5                                             
                                           
                                                                                
                                           
                                                                                
                                           
                                                                                
                                           
   ┌────────────────────┐                                                       
                                           
   │  Projection(t.a)   │                                                       
                                           
   └────────────────────┘                                                       
                                           
              ▲                                                                 
                                           
              │                                                                 
                                           
              │                                                                 
                                           
   ┌────────────────────┐        Filter           ┌────────────────────┐     
Projection     ┌────────────────────┐         
   │  Filter(t.b > 5)   │   ────Pushdown──▶       │  Projection(t.a)   │  
────Pushdown──▶   │  Projection(t.a)   │         
   └────────────────────┘                         └────────────────────┘        
            └────────────────────┘         
              ▲                                              ▲                  
                       ▲                   
              │                                              │                  
                       │                   
              │                                              │                  
                       │                   
   ┌────────────────────┐                         ┌────────────────────┐        
            ┌────────────────────┐         
   │        Scan        │                         │        Scan        │        
            │        Scan        │         
   └────────────────────┘                         │  filter=(t.b > 5)  │        
            │  filter=(t.b > 5)  │         
                                                  └────────────────────┘        
            │  projection=(t.a)  │         
                                                                                
            └────────────────────┘         
                                                                                
                                           
   Initial Plan                                                                 
          Projection pushdown notes that   
                                              If `TableProviderFilterPushDown`  
          the scan only needs t.a          
                                              returns true, filter pushdown     
                                           
                                              pushes the filter into the scan   
          BUT internally evaluating the    
                                                                                
          predicate still requires t.b     
                                                                                
                                           
   ```
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->


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