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

snowflake.snowpark.functions.strtok_to_array¶

snowflake.snowpark.functions.strtok_to_array(text: Union[Column, str], delimiter: Optional[Union[Column, str]] = None) → Column[source]¶

Tokenizes the given string using the given set of delimiters and returns the tokens as an array.

If either parameter is a NULL, a NULL is returned. An empty array is returned if tokenization produces no tokens.

Example::
>>> df = session.create_dataframe(
...     [["a.b.c", "."], ["1,2.3", ","]],
...     schema=["text", "delimiter"],
... )
>>> df.select(strtok_to_array("text", "delimiter").alias("TIME_FROM_PARTS")).collect()
[Row(TIME_FROM_PARTS='[\n  "a",\n  "b",\n  "c"\n]'), Row(TIME_FROM_PARTS='[\n  "1",\n  "2.3"\n]')]
Copy