You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/03 11:54:13 UTC

[GitHub] [arrow-datafusion] alamb commented on pull request #1729: Add median operator

alamb commented on pull request #1729:
URL: https://github.com/apache/arrow-datafusion/pull/1729#issuecomment-1028915016


   > @alamb Am I missing something by any chance?
   
   I had a thought this morning: what if we didn't introduce an `Aggregate` function at all, and instead simply rewrote queries 
   
   so a query that has
   
   ```sql
   select approx_median(x) from foo;
   ```
   
   could be rewritten to 
   ```sql
   select approx_percentile(x, 5.0) as "approx_median(x)" from foo;
   ```
   
   Similar to how we transform `SELECT count(distinct x) from foo` to `select count(*) from (select x from foo group by x)` in https://github.com/realno/arrow-datafusion/blob/add-median-operator/datafusion/src/optimizer/single_distinct_to_groupby.rs#L44
   
   this may be a silly idea, but I wanted to write it down


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org