String Extras / Hashing Functions
16 functions for splitting, formatting, hashing, and URL/Base64 encoding. The source column is always the implicit first input.
| Function | Syntax | Parameters | Notes |
|---|---|---|---|
split | split(column, pattern) | pattern default ",". | Returns an array column. |
split_part | split_part(column, pattern, index) | pattern default ",". index default 1. | Returns a single element from the split (1-indexed). |
format_value | format_value(column, format) | format default "%s" (printf-style). | |
raw_to_hex | raw_to_hex(column) | None. | |
hex_to_raw | hex_to_raw(column) | None. | |
base64_encode | base64_encode(column) | None. | |
base64_decode | base64_decode(column) | None. | |
encode | encode(column, charset) | charset default UTF-8. | String → binary. |
decode | decode(column, charset) | charset default UTF-8. | Binary → string. |
sha1 | sha1(column) | None. | |
md5 | md5(column) | None. | |
soundex | soundex(column) | None. | Phonetic code of the column value. |
levenshtein | levenshtein(column, otherColumn) | otherColumn — column ref. | Edit-distance between the two columns. |
url_encode | url_encode(column) | None. | |
url_decode | url_decode(column) | None. | |
typeof | typeof(column) | None. | Returns the Spark SQL type name of the column as a string. |