rpad
function
Applies to: Databricks SQL Databricks Runtime
Returns expr
, right-padded with pad
to a length of len
.
Arguments
expr
: ASTRING
orBINARY
expression to be padded.len
: AnINTEGER
expression.pad
: An optionalSTRING
orBINARY
expression with the pattern for padding. The default is a space character forSTRING
and x’00’ forBINARY
.
Returns
A BINARY
if both expr
and pad
are BINARY
. Otherwise, returns a STRING
.
If expr
is longer than len
, the return value is shortened to len
characters.
If you do not specify pad
, a STRING
expr
is padded to the right with space characters, whereas a BINARY
expr
is padded to the right with x’00’ bytes.
If len
is less than 1, an empty string.
BINARY
is supported since: Databricks Runtime 11.0.