neilconway commented on code in PR #20278:
URL: https://github.com/apache/datafusion/pull/20278#discussion_r2798992728
##########
datafusion/functions/src/unicode/rpad.rs:
##########
@@ -48,7 +48,10 @@ use unicode_segmentation::UnicodeSegmentation;
+-----------------------------------------------+
```"#,
standard_argument(name = "str", prefix = "String"),
- argument(name = "n", description = "String length to pad to."),
+ argument(
+ name = "n",
+ description = "String length to pad to. If the input string is longer
than this length, it is truncated."
Review Comment:
Thanks for the suggestion! It's actually truncated on the right:
```
> select lpad('xyz', 1);
+----------------------------+
| lpad(Utf8("xyz"),Int64(1)) |
+----------------------------+
| x |
+----------------------------+
1 row(s) fetched.
```
i.e., lpad() and rpad() both truncate on the right. I added the
parenthetical comment for lpad() because it might be a bit surprising that it
pads on the left and truncates on the right, and also to follow the Postgres
docs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]