You are viewing documentation about an older version (1.13.0). View latest version

snowflake.snowpark.functions.split¶

snowflake.snowpark.functions.split(str: Union[Column, str], pattern: Union[Column, str]) → Column[source]¶

Splits a given string with a given separator and returns the result in an array of strings. To specify a string separator, use the lit() function.

Example::
>>> df = session.create_dataframe(
...     [["many-many-words", "-"], ["hello--hello", "--"]],
...     schema=["V", "D"],
... ).select(split(col("V"), col("D")))
>>> df.show()
-------------------------
|"SPLIT(""V"", ""D"")"  |
-------------------------
|[                      |
|  "many",              |
|  "many",              |
|  "words"              |
|]                      |
|[                      |
|  "hello",             |
|  "hello"              |
|]                      |
-------------------------
Copy