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

ASF subversion and git services commented on ASTERIXDB-3615:
------------------------------------------------------------

Commit 07074eab85f69f1d480a846acdc5b496e2f1fe23 in asterixdb's branch 
refs/heads/master from Janhavi Tripurwar
[ https://gitbox.apache.org/repos/asf?p=asterixdb.git;h=07074eab85 ]

[ASTERIXDB-3615][FUN]: lpad and rpad func follow-up

- user model changes: no
- storage format changes: no
- interface changes: no

Deatils:
- Handle the case where the string is empty.
- Add testcases

Ext-ref: MB-67008

Change-Id: I916342d94e3c4b7d6f8f9233b8bb79be26631914
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19863
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Janhavi Tripurwar <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>


> Implement LPAD and RPAD Function
> --------------------------------
>
>                 Key: ASTERIXDB-3615
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3615
>             Project: Apache AsterixDB
>          Issue Type: Task
>          Components: COMP - Compiler, FUN - Functions, RT - Runtime
>            Reporter: Janhavi Tripurwar
>            Assignee: Janhavi Tripurwar
>            Priority: Major
>              Labels: triaged
>
> Add {{LPAD}} *{{}}* {{and RPAD}}Β string functions to support left and right 
> padding up to a target codepoint length. Functions must handle Unicode 
> characters correctly.
> {{*LPAD(input_str, length, pad_str)*}} 
> Returns a new string by prepending {{pad_str}} to {{input_str}} until it 
> reaches {{length}} Unicode codepoints. If {{input_str}} exceeds 
> {{{}length{}}}, it is truncated from the right.
> Example:
> {code:java}
> select lpad('asterix', 11, '$&^'), lpad('πŸ‘©β€πŸ‘©β€πŸ‘§β€', 2, '$'), lpad('πŸ‘©β€πŸ‘©β€πŸ‘§β€', 10, 
> 'πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦'), lpad(null, 4, '%%');{code}
> Result:
> {code:java}
> { $1: "$&^$asterix", $2: "πŸ‘©β€", $3: "πŸ‘©β€πŸ‘©β€πŸ‘©β€πŸ‘©β€πŸ‘§β€", $4: null }{code}
> {{*RPAD(input_str, length, pad_str)*}}
> Returns a new string by appending {{pad_str}} to {{input_str}} until it 
> reaches {{length}} Unicode codepoints. If {{input_str}} exceeds 
> {{{}length{}}}, it is truncated from the right.
> Example:
> {code:java}
> select rpad('asterix', 11, '$&^'), rpad('πŸ‘©β€πŸ‘©β€πŸ‘§β€', 2, '$'), rpad('πŸ‘©β€πŸ‘©β€πŸ‘§β€', 10, 
> 'πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦'), rpad(null, 4, '%%'){code}
> {code:java}
> { $1: "asterix$&^$", $2: "πŸ‘©β€", $3: "πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘©β€πŸ‘©β€", $4: null }{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to