alamb commented on issue #20195:
URL: https://github.com/apache/datafusion/issues/20195#issuecomment-4163958466

   As @LiaCastaneda  says, one thing we talked about was this case
   
   Apparently today, A plan that looks like
   ```
   Join (A.key = B.key)
     BuildInput (A)
     ProbeInput (B)
   ```
   
   It seems like the same dynamic filter is pushed today to all partitions of B 
looks like
   ```sql
   CASE
     HASH(b.key)) % num_partitions
     WHEN 0 THEN <filter from A partition 0 hash table>
     WHEN 1 THEN <filter from A partition 1 hash table> 
   ...
   END
   ```
   
   This predicate can be pushed down to B regardless of how B is partitioned.
   
   However if we know that both A and B are partitioned in the same way by the 
join key (in the sense that any tuple that could possibly match is in the same 
partition on both A and B) then a separate dynamic filter could be used for 
each partition
   
   For example the filter for partition 0 of B, would be:
   
   ```sql
   <filter from A partition 0 hash>
   ```
   
   And the the filter for partition 1 of B, would be:
   
   ```sql
   <filter from A partition 1 hash>
   ```
   
   If DataFusion doesn't already make these per-partition optimized filters, I 
think it would be a good improvement for all plans (and it would effectively 
solve @gene-bordegaray 's problem too)
   
   Disclaimer: this is based on what was said in the sync call I haven't looked 
at the code myself


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