Σημείωση
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να συνδεθείτε ή να αλλάξετε καταλόγους.
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να αλλάξετε καταλόγους.
Right-pad the string column to width len with pad.
For the corresponding Databricks SQL function, see rpad function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.rpad(col=<col>, len=<len>, pad=<pad>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
target column to work on. |
len |
pyspark.sql.Column or int |
length of the final string. |
pad |
pyspark.sql.Column or literal string |
chars to prepend. |
Returns
pyspark.sql.Column: right padded result.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('abcd',), ('xyz',), ('12',)], ['s',])
df.select("*", dbf.rpad(df.s, 6, '#')).show()
df = spark.createDataFrame([('abcd',), ('xyz',), ('12',)], ['s',])
df.select("*", dbf.rpad(df.s, 6, dbf.lit(b"\x75\x76"))).show()