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

   **What changes were proposed in this pull request?**                         
                                                                                
                                         
                                                                                
                                                                                
                                              
   For a shuffle join on two or more equi-join keys, InjectRuntimeFilter builds 
a Bloom filter on each key independently. This PR adds an optional composite 
Bloom filter over the hash of the whole key tuple (xxhash64(k1, k2, ...)), in 
addition to the per-key filters, when all keys originate from the same scan on 
both sides of the join.                                                         
 
                                                                                
                                                                                
                                              
        - New config spark.sql.optimizer.runtime.bloomFilter.composite.enabled 
(default false).                                                                
                                               
        - injectBloomFilter now takes a sequence of keys; the single-key path 
is unchanged.                                                                   
                                                
        - The composite filter is injected only when every key is a simple, 
binary stable expression with no DPP filter, and all keys trace to a single 
scan on each side.                                    
        - A new hasCompositeBloomFilter check keeps the rule idempotent.        
                                                                                
                                              
                                                                                
                                                                                
                                              
        The per-key filters are kept so pruning is never weaker than before; 
the composite filter is additive.                                               
                                                 
                                                                                
                                                                                
                                              
   **Why are the changes needed?**                                              
                                                                                
                                         
                                                                                
                                                                                
                                              
    Independent per-key filters cannot reject key combinations that never occur 
together on the creation side. For correlated keys this lets many non-matching 
rows into the shuffle. A composite filter over the key tuple rejects those 
combinations.                                                                   
                                                                              
                                                                                
                                                                                
                                              
   In a local test on a 20M-row fact table joined on (a, b) with a correlated 
creation side, shuffle bytes dropped from 4,802,528 to 50,528 (about 95x) with 
identical join results. For independent keys the composite filter prunes 
nothing extra, as expected, which is why it is off by default.                  
                                                                                
     
                                                                                
                                                                                
                                                   **Does this PR introduce any 
user-facing change?**                                                           
                                                                                
         
                                                                                
                                                                                
                                              
   No behavior change by default. When the new config is enabled, eligible 
multi-column equi-joins get an additional runtime Bloom filter.                 
                                              
                                                                                
                                                                                
                                              
   **How was this patch tested?**                                               
                                                                                
                                         
                                                                                
                                                                                
                                              
   New tests in InjectRuntimeFilterSuite covering: composite filter injected 
for a two-key correlated join (same join result with and without the feature), 
idempotency                                                       
                                                                                
                                                                                
                                              
   **Was this patch authored or co-authored using generative AI tooling?**      
                                                                                
                                         
                                                                                
                                                                                
                                              
   Yes, used 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