neilconway opened a new pull request, #22700:
URL: https://github.com/apache/datafusion/pull/22700

   ## Which issue does this PR close?
   
   - Closes #22699
   
   ## Rationale for this change
   
   `stats_cartesian_product` computes the total byte size of a cross join as:
   
   ```rust
         let total_byte_size = left_stats
             .total_byte_size
             .multiply(&right_stats.total_byte_size)
             .multiply(&Precision::Exact(2));
   ```
   
   This is wrong (e.g., it multiples two byte-size values together). The 
correct formula is "left-num-rows * right-size-in-bytes + right-num-rows * 
left-size-in-bytes", since the left side is repeated once per row on the right, 
and vice versa.
   
   ## What changes are included in this PR?
   
   * Fix total byte size formula for cross join
   * Update expected SLT results
   
   ## Are these changes tested?
   
   Yes; covered by existing tests.
   
   ## Are there any user-facing changes?
   
   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