RPAD

Uses a given padstring to right pad a string to a certain size.

Syntax

RPAD(STRING, SIZE, PADSTRING)

Arguments

STRING

Type: string

The string to be padded.

SIZE

Type: bigint

A non-negative integer specifying the length of the result string.

PADSTRING

Type: string

The string to use for padding. This must be non-empty.

Returns

Type: string

STRING right padded to SIZE with PADSTRING.

If SIZE is less than the length of STRING, the result is truncated to SIZE characters.

Examples

STRINGSIZEPADSTRINGOutput

Call me Ishmael. Some years ago

7

Call me

drizzly November

16

.

drizzly November

right

1

r

what

9

?!

what?!?!?

null

9

''

null

hi

5

five

hifiv

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
    AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data MAP_COLUMNS_BY_NAME
    SELECT 
        customer_firstname,
        RPAD(customer_firstname, 10, 'x') AS padded_firstname
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE time_filter()
    LIMIT 3;

Query result

customer_firstnamepadded_firstname

Angela

Angelaxxxx

Charlotte

Charlottex

Frances

Francesxxx

Last updated