AngersZhuuuu opened a new pull request, #46568:
URL: https://github.com/apache/spark/pull/46568

   ### What changes were proposed in this pull request?
   Plan after PropagateEmptyRelation may generate double local limit
   ```
    GlobalLimit 21                                                              
                                                              
    +- LocalLimit 21                                                            
                                                             
   !   +- Union false, false                                                    
                                                                  
   !      :- LocalLimit 21                                                      
                                                                    
   !      :  +- Project [item_id#647L]                                          
                                                                     
   !      :     +- Filter (xxxx)        
   !      :        +- Relation db.table[,... 91 more fields] parquet
   !      +- LocalLimit 21
   !         +- Project [item_id#738L]
   !            +- LocalRelation <empty>, [, ... 91 more fields]
   ```
   to 
   ```
    GlobalLimit 21                                                              
                                                              
       +- LocalLimit 21                                                         
                                                                                
                                                                                
              
          - LocalLimit 21                                                       
                                                                   
             +- Project [item_id#647L]                                          
                                                                     
               +- Filter (xxxx)        
                  +- Relation db.table[,... 91 more fields] parquet
   ```
   after `Infer window group limit batch` batch's `EliminateLimits`
   will be 
   ```
    GlobalLimit 21                                                              
                                                              
       +- LocalLimit least(21, 21)                                              
                                                                                
                                                                                
                                                                                
                                                              
             +- Project [item_id#647L]                                          
                                                                     
               +- Filter (xxxx)        
                  +- Relation db.table[,... 91 more fields] parquet
   ```
   It can't work, here miss a `ConstantFolding`
   
   ### Why are the changes needed?
   Fix bug
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to