You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "ozankabak (via GitHub)" <gi...@apache.org> on 2023/05/25 18:04:57 UTC

[GitHub] [arrow-datafusion] ozankabak commented on pull request #6445: Add support for FIRST_VALUE, LAST_VALUE Aggregate Functions

ozankabak commented on PR #6445:
URL: https://github.com/apache/arrow-datafusion/pull/6445#issuecomment-1563304302

   Note that this change makes `FIRST_VALUE` and `LAST_VALUE` functions, which are already available as window functions, also available in an aggregation context so that one can choose first/last values within a group according to a given ordering. These functions are sometimes called `FIRST` and `LAST` in other query engines/DBs, but we chose to use the same with their window function counterparts (as in the case of `SUM`, `COUNT` etc.)
   
   Having said that, there are few minor issues here that we will fix shortly. I think the example in the PR body should read something like:
   ```sql
   SELECT a, FIRST_VALUE(c ORDER BY b DESC) as first_c
   FROM table
   GROUP BY a
   ```
   This will return the first `c` value, according to the reverse `b` order, for every `a` group.
   
   Also some tests are failing. We will fix the tests, make the PR body clearer and possibly add another test that looks like this.


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