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

James Taylor commented on PHOENIX-1002:
---------------------------------------

There are a few reasons to only support the operator instead of both:
- If query using the % operator is converted to a string, it'll look like the 
MOD built-in function was used (as there can be only a single toString 
implementation) which isn't a huge deal, but it's somewhat confusing.
- Consistency - the other operators (*, /, +, -) do not have an associated 
built-in function.
- It'd be a simple change. The evaluate method wouldn't change. You'd simply 
have to derive the class from ArithmeticExpression instead of ScalarFunction, 
implement the abstract method that defines the string representation of the 
operator, and remove the annotation and the getName method. Probably best if 
the class was renamed to ModulusOperator too.

> Add support for % operator
> --------------------------
>
>                 Key: PHOENIX-1002
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1002
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Thomas D'Silva
>         Attachments: PHOENIX-1002.patch, PHOENIX-1002_2.patch, 
> PHOENIX-1002_3.patch
>
>
> Supporting the % operator would allow using sequences to generate IDs that 
> are less than a maximum number. 
> CREATE SEQUENCE foo.bar
> SELECT ((NEXT VALUE FOR foo.bar)%1000)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to