Dandandan opened a new issue, #18840:
URL: https://github.com/apache/datafusion/issues/18840

   ### Is your feature request related to a problem or challenge?
   
   Currently we only consider hash join order during planning time.
   As this relies on rough estimates/heuristics, it can be the case the order 
is suboptimal and the order can be adjusted during exectution by looking at the 
actual size of the (build-side) data.
   
   I added some log to the execution: for TPC-H query 7 and 21 can be adjusted 
when running with in-memory data, and query 4 when running on Parquet data 
(both for SF=1 and SF=10).
   
   ### Describe the solution you'd like
   
   Based on the left side (partition or all) we can swap the join order if the 
size is smaller than the probe side (before building the build side.
   
   The changed execution should look as follows:
   
   * Detect the left side is smaller based on actual (left/build) size + 
estimated (right/probe) side
   * Check if both sides will still fit in memory (lower than 
collect_left_threshold)
   * Convert (left) side to in-memory stream
   * Load right side into memory (we can recheck if the side is *really* 
smaller)
   * Produce batches normally
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


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