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

    **What changes were proposed in this pull request?**                        
                                                                                
                                              
                                                                                
                                                                                
                                              
   InsertAdaptiveSparkPlan now remembers the subquery plans it has already 
compiled, keyed by exprId. buildSubqueryMap reuses a cached plan instead of 
compiling the same subquery again. A regression test is added to 
DynamicPartitionPruningV1SuiteAEOn.                                             
                                                                                
                     
                                                                                
                                                                                
                                              
   **Why are the changes needed?**                                              
                                                                                
                                             
                                                                                
                                                                                
                                              
   With AQE on, dynamic pruning filters in a chain of joins nest inside each 
other. Each nested compile started with an empty map, so a chain of n joins 
needed 2^n - 1 compilations. Now it needs n(n+1)/2, the same as AQE off.        
                                                                                
                                                                                
  
                                                                                
                                                                                
                                              
   With 11 left joins over small partitioned tables, join planner calls drop 
from 2047 to 66, planning time from 465 ms to 64 ms, and allocation from 362 MB 
to 19 MB.                                   
                                                                                
                                                                                
                                              
   **Does this PR introduce any user-facing change?**                           
                                                                                
                                             
                                                                                
                                                                                
                                              
   No.                                                                          
                                                                                
                                         
                                                                                
                                                                                
                                              
   **How was this patch tested?**                                               
                                                                                
                                             
                                                                                
                                                                                
                                              
   Added a test to DynamicPartitionPruningV1SuiteAEOn. It fails without the 
change (255 planner calls) and passes with it (36). The existing 
DynamicPartitionPruning*, AdaptiveQueryExecSuite, SubquerySuite and 
ReuseExchangeAndSubquerySuite suites also pass.
   
   **Was this patch authored or co-authored using generative AI tooling?** 
   Yes, Generated-by: Claude Code (Claude Opus 5.5)


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