GitHub user tzolkincz opened a pull request:

    https://github.com/apache/incubator-phoenix/pull/30

    Add functions FIRST_BY and LAST_BY

    I've created aggregation functions like oracles FIRST_VALUE 
(http://www.oracle-base.com/articles/misc/first-value-and-last-value-analytic-functions.php).
 Null values will be skipped. Syntax is FIRST_BY(value, over[, offset]). 
Example of usage: you wanna get first value by date.
    ```
    SELECT FIRST_BY(value, date) FROM table GROUP BY something
    ```
    if you specify offset value, you'll get second youngest value. Query will 
looks like
    ```
    SELECT LAST_BY(value, date, 2) FROM table GROUP BY something
    ```
    
    Thanks for merge.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tzolkincz/incubator-phoenix firstBy-lastBy

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-phoenix/pull/30.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #30
    
----
commit b2842d490c5e782e43b029203de22fa6153dc449
Author: tzolkincz <[email protected]>
Date:   2014-04-01T09:53:25Z

    create FirstBy and LastBy aggregation functions

commit 032bb1c622370012d0b0fd5b56eeed72f9e26f06
Author: tzolkincz <[email protected]>
Date:   2014-04-17T07:48:59Z

    modify order by SortOrder modifier

commit fc0c35edc290a4e8e144bf1511ff4b5e035ed3f6
Author: tzolkincz <[email protected]>
Date:   2014-04-17T08:29:55Z

    refactor

commit 4ec410fa3c067d36e6e2577834f539911a455b03
Author: Vaclav Loffelmann <[email protected]>
Date:   2014-04-17T13:13:51Z

    refactor evaluate

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to