phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-1987) SIGN built-in function should be order preserving
Date Fri, 12 Jun 2015 01:54:00 GMT


James Taylor commented on PHOENIX-1987:

I see - good find. Looks like if you override perservesOrder(), then you also must override
getKeyFormationTraversalIndex. We should either change the default implementation for getKeyFormationTraversalIndex()
in ScalarFunction to this:
    public int getKeyFormationTraversalIndex() {
        return preservesOrder() == OrderPreserving.NO ? NO_TRAVERSAL : 0;
Having the default be 0 in this case makes sense, as it's pretty much always been the case
that the first argument is the one that needs to be considered.

Or at a minimum, add a note to the java doc for FunctionExpression.preservesOrder() and for

Also, any corner case that make these math functions not order preserving (i.e. using negative
values for first or second argument, etc.)?

> SIGN built-in function should be order preserving
> -------------------------------------------------
>                 Key: PHOENIX-1987
>                 URL:
>             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,
> 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

View raw message