[ 
https://issues.apache.org/jira/browse/PHOENIX-1290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14146534#comment-14146534
 ] 

James Taylor commented on PHOENIX-1290:
---------------------------------------

Try this:
{code}
select
        ss_customer_sk,
        first_value(ss_sold_date_sk)
within group
        (order by ss_sold_date_sk asc) as f
from
        store_sales
group by
        ss_customer_sk;
{code}


> Cannot alias a FIRST_VALUE column
> ---------------------------------
>
>                 Key: PHOENIX-1290
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1290
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Carter Shanklin
>
> So this works:
> {code}
> select
>         ss_customer_sk,
>         first_value(ss_sold_date_sk)
> within group
>         (order by ss_sold_date_sk asc)
> from
>         store_sales
> group by
>         ss_customer_sk;
> {code}
> And this doesn't:
> {code}
> select
>         ss_customer_sk,
>         first_value(ss_sold_date_sk) as f
> within group
>         (order by ss_sold_date_sk asc)
> from
>         store_sales
> group by
>         ss_customer_sk;
> {code}
> You get:
> {code}
> Error: ERROR 605 (42P00): Syntax error. Unknown function: "FIRST_VALUE". 
> (state=42P00,code=605)
> {code}
> Same result if I drop the "as".
> This makes it difficult to use first_value in connection with the new subjoin 
> feature. FIRST_VALUE spits out a very strange column name (in this case it's 
> null(SS_SOLD_DATE_SK, true, SS_SOLD_DATE_SK)).
> Probably affects NTH_VALUE and LAST_VALUE as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to