[ 
https://issues.apache.org/jira/browse/PHOENIX-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas D'Silva updated PHOENIX-995:
-----------------------------------

    Description: 
Add ENCODE(input number, format encodeformat) which can be used to convert a 
base 10 number to a number base 62

Add LPAD(input string, length int [, fill string]) which can be used to left 
pad an input string. 

Together these two functions can be used to generate IDs using sequences, for 
example:
{code:sql}
CREATE SEQUENCE foo.bar START WITH 0 INCREMENT BY 62
SELECT LPAD(ENCODE((NEXT VALUE FOR foo.bar,62),'BASE62'), 10,'0') FROM 
SYSTEM."SEQUENCE"
{code}

  was:
Add TO_STRING(input number, base number) which can be used to convert a base 10 
number to a number in any base between 2 to 62.

Add LPAD(input string, length int [, fill string]) which can be used to left 
pad an input string. 

Together these two functions can be used to generate IDs using sequences, for 
example:
{code:sql}
CREATE SEQUENCE foo.bar START WITH 0 INCREMENT BY 62
SELECT LPAD(TO_STRING(NEXT VALUE FOR foo.bar,62), 10,'0') FROM SYSTEM."SEQUENCE"
{code}


> ADD ENCODE AND LPAD functions 
> ------------------------------
>
>                 Key: PHOENIX-995
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-995
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Thomas D'Silva
>
> Add ENCODE(input number, format encodeformat) which can be used to convert a 
> base 10 number to a number base 62
> Add LPAD(input string, length int [, fill string]) which can be used to left 
> pad an input string. 
> Together these two functions can be used to generate IDs using sequences, for 
> example:
> {code:sql}
> CREATE SEQUENCE foo.bar START WITH 0 INCREMENT BY 62
> SELECT LPAD(ENCODE((NEXT VALUE FOR foo.bar,62),'BASE62'), 10,'0') FROM 
> SYSTEM."SEQUENCE"
> {code}



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

Reply via email to