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:22:00 GMT


James Taylor commented on PHOENIX-1987:

Don't override getKeyFormationTraversalIndex. That's only used for cases in which a function
preserves the original identify of the argument. An example is CoerceExpression which changes
the type, but preserves the identify. Another is the INVERT(x) which is the same as the original
with just the bits inverted. That won't be the case for these math functions.

I believe the following query should use a reverse scan:
All the CEIL, TRUNC, FLOOR, ROUND functions output their argument in ASC order, even if they
come in DESC. So having an ORDER BY clause like the above, it should be order preserving.
Is that what you're finding?

FYI, you can check if the order is forward versus reverse by comparing the plan.getOrderBy()
with OrderBy.FWD_ROW_KEY_ORDER_BY or OrderBy.REV_ROW_KEY_ORDER_BY as you can see in some of
the tests in QueryCompilerTest.

> 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