Skip to content

String

ascii

ascii(col: String) -> Int

Returns the ASCII code of the first character of col.

Wrapper for pyspark.sql.functions.ascii.

bin

bin(col: Numeric) -> String

Returns the binary representation of col as a string.

Wrapper for pyspark.sql.functions.bin.

btrim

btrim(col: String, trim: String | None = None) -> String

Removes leading and trailing characters from col. Removes whitespace when trim is omitted.

Wrapper for pyspark.sql.functions.btrim.

char

char(col: Integer) -> String

Returns the character for the given ASCII code point col.

Wrapper for pyspark.sql.functions.char.

char_length

char_length(col: String) -> Int

Returns the number of characters in col.

Wrapper for pyspark.sql.functions.char_length.

concat

concat(*cols: String) -> String
concat(*cols: T) -> T
concat(*cols: String | Array) -> String | Array

Concatenates multiple string or array columns.

Wrapper for pyspark.sql.functions.concat.

concat_ws

concat_ws(sep: str, *cols: String) -> String

Concatenates string columns using sep as separator, skipping nulls.

Wrapper for pyspark.sql.functions.concat_ws.

contains

contains(left: String, right: String) -> Bool
contains(left: Binary, right: Binary) -> Bool
contains(
    left: String | Binary, right: String | Binary
) -> Bool

Returns true if left contains right.

Wrapper for pyspark.sql.functions.contains.

decode

decode(col: Binary, charset: str) -> String

Decodes a binary column col to a string using the given charset.

Wrapper for pyspark.sql.functions.decode.

encode

encode(col: String, charset: str) -> Binary

Encodes string column col to binary using the given charset.

Wrapper for pyspark.sql.functions.encode.

endswith

endswith(col: String, suffix: String) -> Bool

Returns true if col ends with suffix.

Wrapper for pyspark.sql.functions.endswith.

find_in_set

find_in_set(col: String, str: String) -> Int

Returns the 1-based position of col in the comma-separated list str, or 0 if not found.

Wrapper for pyspark.sql.functions.find_in_set.

format_number

format_number(col: Numeric, d: int) -> String

Formats col as a number with d decimal places using US locale grouping (e.g. 1,234.56).

Wrapper for pyspark.sql.functions.format_number.

format_string

format_string(format: str, *cols: Column) -> String

Returns a formatted string using printf-style format and the given columns.

Wrapper for pyspark.sql.functions.format_string.

hex

hex(col: Column) -> String

Returns the hexadecimal string representation of col.

Wrapper for pyspark.sql.functions.hex.

initcap

initcap(col: String) -> String

Returns col with the first letter of each word capitalised.

Wrapper for pyspark.sql.functions.initcap.

instr

instr(col: String, substr: str) -> Int

Returns the 1-based position of the first occurrence of substr in col, or 0 if not found.

Wrapper for pyspark.sql.functions.instr.

left

left(col: String, len: Integer | int) -> String

Returns the leftmost len characters of col.

Wrapper for pyspark.sql.functions.left.

length

length(col: String | Binary) -> Int

Returns the character length of a string, or the byte length of a binary column.

Wrapper for pyspark.sql.functions.length.

levenshtein

levenshtein(
    col1: String, col2: String, threshold: int | None = None
) -> Int

Returns the Levenshtein distance between col1 and col2. Returns -1 if the distance exceeds threshold.

Wrapper for pyspark.sql.functions.levenshtein.

locate

locate(substr: str, col: String, pos: int = 1) -> Int

Returns the 1-based position of the first occurrence of substr in col at or after pos.

Wrapper for pyspark.sql.functions.locate.

lower

lower(col: String) -> String

Returns col converted to lowercase.

Wrapper for pyspark.sql.functions.lower.

lpad

lpad(
    col: String, len: Integer | int, pad: String | str
) -> String

Left-pads col with pad to a total length of len characters.

Wrapper for pyspark.sql.functions.lpad.

ltrim

ltrim(col: String, trim: String | None = None) -> String

Removes leading characters from col. Removes whitespace when trim is omitted.

Wrapper for pyspark.sql.functions.ltrim.

octet_length

octet_length(col: String | Binary) -> Int

Returns the byte length of col.

Wrapper for pyspark.sql.functions.octet_length.

overlay

overlay(
    col: String,
    replace: String,
    pos: Integer | int,
    len: Integer | int = -1,
) -> String

Replaces a substring of col starting at pos with replace. Replaces len characters when provided.

Wrapper for pyspark.sql.functions.overlay.

regexp_extract

regexp_extract(
    string: String, pattern: str, idx: int
) -> String

Extracts the idx-th regex group matched by pattern from string.

Wrapper for pyspark.sql.functions.regexp_extract.

regexp_extract_all

regexp_extract_all(
    string: String,
    pattern: str | String,
    idx: int | None = None,
) -> Array[String]

Extracts all substrings of string matching the regex group at idx.

Wrapper for pyspark.sql.functions.regexp_extract_all.

regexp_replace

regexp_replace(
    string: String,
    pattern: str | String,
    replacement: str | String,
) -> String

Replaces all substrings of string matching pattern with replacement.

Wrapper for pyspark.sql.functions.regexp_replace.

repeat

repeat(col: String, n: Integer | int) -> String

Returns col repeated n times.

Wrapper for pyspark.sql.functions.repeat.

replace

replace(
    src: String,
    search: String,
    replace: String | None = None,
) -> String

Replaces all occurrences of search in src with replace. Removes matches when replace is omitted.

Wrapper for pyspark.sql.functions.replace.

reverse

reverse(col: String) -> String
reverse(col: Array[T]) -> Array[T]
reverse(col: String | Array) -> String | Array

Reverses the characters of a string column, or the elements of an array column.

Wrapper for pyspark.sql.functions.reverse.

right

right(col: String, len: Integer | int) -> String

Returns the rightmost len characters of col.

Wrapper for pyspark.sql.functions.right.

rpad

rpad(
    col: String, len: Integer | int, pad: String | str
) -> String

Right-pads col with pad to a total length of len characters.

Wrapper for pyspark.sql.functions.rpad.

rtrim

rtrim(col: String, trim: String | None = None) -> String

Removes trailing characters from col. Removes whitespace when trim is omitted.

Wrapper for pyspark.sql.functions.rtrim.

sha1

sha1(col: Binary | String) -> String

Returns the SHA-1 hex digest of col.

Wrapper for pyspark.sql.functions.sha1.

sha2

sha2(col: Binary | String, numBits: int) -> String

Returns the SHA-2 hex digest of col using numBits-bit hash (224, 256, 384, or 512).

Wrapper for pyspark.sql.functions.sha2.

soundex

soundex(col: String) -> String

Returns the Soundex phonetic code for col.

Wrapper for pyspark.sql.functions.soundex.

split

split(
    col: String,
    pattern: Column | str,
    limit: Int | int = -1,
)

Splits col around occurrences of pattern (regex), returning an array of strings.

Wrapper for pyspark.sql.functions.split.

split_part

split_part(
    src: String, delimiter: String, partNum: Int
) -> String

Splits src by delimiter and returns the partNum-th part (1-based).

Wrapper for pyspark.sql.functions.split_part.

startswith

startswith(str: String, prefix: String) -> Bool

Returns true if str starts with prefix.

Wrapper for pyspark.sql.functions.startswith.

substr

substr(
    col: String,
    startPos: Integer | int,
    length: Integer | int | None = None,
) -> String

Returns the substring of col from startPos (1-based). Includes all remaining characters when length is omitted.

Wrapper for pyspark.sql.functions.substr.

substring

substring(
    str: String, pos: Int | int, len: Int | int
) -> String

Returns the substring of str starting at pos (1-based) with at most len characters.

Wrapper for pyspark.sql.functions.substring.

substring_index

substring_index(
    col: String, delim: str, count: int
) -> String

Returns everything to the left of the count-th occurrence of delim in col. Negative count counts from the right.

Wrapper for pyspark.sql.functions.substring_index.

translate

translate(
    col: String, matchingString: str, replaceString: str
) -> String

Translates characters in col by replacing each character in matchingString with the corresponding character in replaceString.

Wrapper for pyspark.sql.functions.translate.

trim

trim(col: String, trim: String | None = None)

Removes leading and trailing whitespace from col, or the characters in trim when provided.

Wrapper for pyspark.sql.functions.trim.

unhex

unhex(col: String) -> Binary

Decodes a hexadecimal string col into binary.

Wrapper for pyspark.sql.functions.unhex.

upper

upper(col: String) -> String

Returns col converted to uppercase.

Wrapper for pyspark.sql.functions.upper.

url_decode

url_decode(col: String) -> String

Decodes a URL-encoded string column col.

Wrapper for pyspark.sql.functions.url_decode.

url_encode

url_encode(col: String) -> String

URL-encodes string column col using application/x-www-form-urlencoded format.

Wrapper for pyspark.sql.functions.url_encode.

unbase64

unbase64(col: String) -> Binary

Decodes a Base64-encoded string column col into binary.

Wrapper for pyspark.sql.functions.unbase64.