snowflake.snowpark.functions.octet_length¶

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

Returns the length of a string or binary value in bytes. This will be the same as LENGTH for ASCII strings and greater than LENGTH for strings using Unicode code points. For binary, this is always the same as LENGTH.

Example:

>>> df = session.create_dataframe(['abc', 'Î’', "X'A1B2'"], schema=["a"])
>>> df.select(octet_length(col("a")).alias("octet_length")).collect()
[Row(OCTET_LENGTH=3), Row(OCTET_LENGTH=2), Row(OCTET_LENGTH=7)]
Copy