pyspark.sql.functions.unhex¶
-
pyspark.sql.functions.unhex(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Inverse of hex. Interprets each pair of characters as a hexadecimal number and converts to the byte representation of number.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Columnor str target column to work on.
- col
- Returns
Columnstring representation of given hexadecimal value.
Examples
>>> spark.createDataFrame([('414243',)], ['a']).select(unhex('a')).collect() [Row(unhex(a)=bytearray(b'ABC'))]