snowflake.snowpark.functions.strtok_to_array

snowflake.snowpark.functions.strtok_to_array(text: Union[Column, str], delimiter: Optional[Union[Column, str]] = None) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2354-L2380)

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
语言: 中文