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

snowflake.snowpark.functions.length¶

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

Returns the length of an input string or binary value. For strings, the length is the number of characters, and UTF-8 characters are counted as a single character. For binary, the length is the number of bytes.

Example:

>>> df = session.create_dataframe(["the sky is blue", "WE CAN HANDLE THIS", "ÄäÖößÜü", None], schema=["a"])
>>> df.select(length(df["a"]).alias("length")).collect()
[Row(LENGTH=15), Row(LENGTH=18), Row(LENGTH=7), Row(LENGTH=None)]
Copy