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

Shuxiong Ye commented on PHOENIX-1987:
--------------------------------------

If not override getKeyFormationTraversalIndex in SignFunction, the below 
statement will get java.lang.IndexOutOfBoundsException, which I go deep into 
it, and find it caused by SignFunction's super class ScalarFunction's function 
getKeyFormationTraversalIndex

{code:java}
            QueryPlan plan = 
conn.createStatement().unwrap(PhoenixStatement.class).compileQuery(query);
{code}

ScalarFunction's function getKeyFormationTraversalIndex looks like
{code:java}
    public int getKeyFormationTraversalIndex() {
        return NO_TRAVERSAL; // --> it is -1
    }
{code}

I happen to refer to RoundDateExpression previously, and it also has 
getKeyFormationTraversalIndex which returns 0, too.
Is there any Expression I can refer to?

Thanks

> SIGN built-in function should be order preserving
> -------------------------------------------------
>
>                 Key: PHOENIX-1987
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1987
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Shuxiong Ye
>             Fix For: 5.0.0, 4.5.0, 4.4.1
>
>         Attachments: 
> 0001-PHOENIX-1987-SIGN-built-in-function-should-be-order_v2.patch, 
> 0001-PHOENIX-1987-fixing-getKeyFormationTraversalIndex-in-SIGN-function.patch
>
>
> The SIGN built-in function preserves the order of its input. This needs to be 
> explicitly implemented in SignFunction by implementing the following method:
> {code}
>     public OrderPreserving preservesOrder() {
>         return OrderPreserving.YES;
>     }
> {code}
> This will allow certain optimizations reducing the amount of memory and/or 
> buffering that is required if SIGN is used in a GROUP BY or ORDER BY clause.



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

Reply via email to