Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lpad/rpad function support default value #15021

Closed
wangsimo0 opened this issue Dec 10, 2022 · 2 comments · Fixed by #22839
Closed

lpad/rpad function support default value #15021

wangsimo0 opened this issue Dec 10, 2022 · 2 comments · Fixed by #22839
Assignees

Comments

@wangsimo0
Copy link
Contributor

wangsimo0 commented Dec 10, 2022

Feature request

StarRocks already support the rpad function and lpad function. However, the third parameter is not optional.
For easy to use purpose, it's better to make the third value optional with a default value ' ', a single blank.
That means:

  1. For lpad: https://docs.starrocks.io/en-us/latest/sql-reference/sql-functions/string-functions/lpad
    It will be like:
VARCHAR lpad(VARCHAR str, INT len [, VARCHAR pad])
SELECT lpad("hi", 5);

will be equal to

SELECT lpad("hi", 5, " ");

and returns

+---------------------+
| lpad('hi', 5)       |
+---------------------+
|      hi             |
+---------------------+
  1. For rpad :https://docs.starrocks.io/en-us/latest/sql-reference/sql-functions/string-functions/rpad
VARCHAR rpad(VARCHAR str, INT len [, VARCHAR pad])
SELECT rpad("hi", 5);

will be equal to

SELECT rpad("hi", 5, " ");

and returns

+---------------------+
| lpad('hi', 5) |
+---------------------+
| hi                    |
+---------------------+
@kateshaowanjou
Copy link
Contributor

@predator4ann Can you make a comment here so I can assign this issue to you?

@predator4ann
Copy link
Contributor

@kateshaowanjou Sure, you can assign the issue to me. Let me know if you have any further questions or concerns.

@wangsimo0 wangsimo0 added the good first issue Good for newcomers label May 12, 2023
kangkaisen pushed a commit that referenced this issue May 17, 2023

## Which issues of this PR fixes:
Fixes #15021


Signed-off-by: predator4ann <yunlong.sun@hotmail.com>
Moonm3n pushed a commit to Moonm3n/starrocks that referenced this issue May 23, 2023
## Which issues of this PR fixes:
Fixes StarRocks#15021

Signed-off-by: predator4ann <yunlong.sun@hotmail.com>
Signed-off-by: Moonm3n <saxonzhan@gmail.com>
abc982627271 pushed a commit to abc982627271/starrocks that referenced this issue Jun 5, 2023

## Which issues of this PR fixes:
Fixes StarRocks#15021


Signed-off-by: predator4ann <yunlong.sun@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants