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

   ## Which issue does this PR close?
   
   Fixes #992 
   
   ## Rationale for this change
   
   Some statistics can propagate through expressions, such as min, max and sum.
   
   In this particular case, I was looking at the ClickBench Q29 and realized we 
had no way to report sum statistics to DataFusion (which would also help for 
avg).
   
   Q29 looks like this btw:
   ```sql
   SELECT SUM("ResolutionWidth"), SUM("ResolutionWidth" + 1), 
SUM("ResolutionWidth" + 2), SUM("ResolutionWidth" + 3), SUM("ResolutionWidth" + 
4), ... SUM("ResolutionWidth" + 88), SUM("ResolutionWidth" + 89) FROM hits;
   ```
   
   ## What changes are included in this PR?
   
   `PhysicalExpr` has a new defaulted trait function `compute_statistics` that 
takes a `Statistics` and returns statistics for the columnar result of the 
expression. (Unlike the linked issue which proposes returning a full Statistics 
object).
   
   Further, this PR adds a `sum` statistic to demonstrate the value of 
propagation.
   
   ## Are these changes tested?
   
   ## Are there any user-facing changes?
   


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