Kopīgot, izmantojot


hex

A pyspark.sql.types.BinaryType, pyspark.sql.types.IntegerType or pyspark.sql.types.LongType. Supports Spark Connect.

For the corresponding Databricks SQL function, see hex function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.hex(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or column name target column to work on.

Returns

pyspark.sql.Column: hexadecimal representation of given value as string.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('ABC', 3)], ['a', 'b'])
df.select('*', dbf.hex('a'), dbf.hex(df.b)).show()
+---+---+------+------+
|  a|  b|hex(a)|hex(b)|
+---+---+------+------+
|ABC|  3|414243|     3|
+---+---+------+------+