Delen via


hex

A pyspark.sql.types.BinaryType, pyspark.sql.types.IntegerType of pyspark.sql.types.LongType. Ondersteunt Spark Connect.

Voor de overeenkomstige Databricks SQL-functie, zie de hex functie.

Syntaxis

from pyspark.databricks.sql import functions as dbf

dbf.hex(col=<col>)

Parameterwaarden

Kenmerk Typologie Description
col pyspark.sql.Column or column name doelkolom waaraan moet worden gewerkt.

Retouren

pyspark.sql.Column: hexadecimale weergave van de opgegeven waarde als tekenreeks.

Voorbeelden

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|
+---+---+------+------+