Skip to main content

sha

Returns a sha1 hash value as a hex string of the column.

For the corresponding Databricks SQL function, see sha function.

Syntax​

Python
from pyspark.sql import functions as dbf

dbf.sha(col=<col>)

Parameters​

Parameter

Type

Description

col

pyspark.sql.Column or str

Target column to compute on.

Parameter

Type

Description

col

pyspark.sql.Column or str

Target column to compute on.

Examples​

Python
from pyspark.sql import functions as dbf
df = spark.range(1).select(dbf.sha(dbf.lit("Spark")))
df.show()
Output
+--------------------+
| sha(Spark)|
+--------------------+
|85f5955f4b27a9a4c...|
+--------------------+