SPLIT
Syntax
SPLIT( orig_string [ , delimiter [ , part_index ] ] )
Description
It splits orig_string into a sequence of substrings using the delimiter character as separator and returns the substring whose number is equal to the part_index parameter. By default, the delimiting character is comma. If part_index is negative, the substring to return is counted from the end of orig_string. If the number of substrings is less than the part_index absolute valuepart_index was not provided, the function returns an array of the substrings (only for ClickHouse, PostgreSQL sources).
Argument types:
orig_string—Stringdelimiter—Stringpart_index—Integer
Return type: Depends on argument types
Note
Only constant values are accepted for the arguments (delimiter).
Examples
SPLIT("192.168.0.1", ".", 1) = "192"
SPLIT("192.168.0.1", ".", -1) = "1"
SPLIT("192.168.0.1", ".", 5) = ""
SPLIT("192.168.0.1", ".") = "['192 ','168 ','0 ','1']"
SPLIT("192.168.0.1") = "192.168.0.1"
SPLIT("a,b,c,d") = "['a','b','c','d']"
Data source support
ClickHouse 21.8, Files, Google Sheets, MySQL 5.7, PostgreSQL 9.3, Yandex Documents, YDB.