snowflake.snowpark.functions.try_hex_decode_string¶

snowflake.snowpark.functions.try_hex_decode_string(input_expr: Union[snowflake.snowpark.column.Column, str]) → Column[source]¶

Decodes a hex-encoded string to its original string value. Returns None if the input is not a valid hex string.

Parameters:

input_expr (ColumnOrName) – The hex-encoded string to decode.

Returns:

The decoded string, or None if the input is not valid hex.

Return type:

Column

Examples::
>>> df = session.create_dataframe([["41614262"], ["127"], ["invalid_hex"]], schema=["hex_input"])
>>> df.select(try_hex_decode_string(df["hex_input"]).alias("decoded")).collect()
[Row(DECODED='AaBb'), Row(DECODED=None), Row(DECODED=None)]
Copy