pyspark.sql.functions.md5

pyspark.sql.functions.md5(col: ColumnOrName) → pyspark.sql.column.Column[source]

Calculates the MD5 digest and returns the value as a 32 character hex string.

New in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or str

target column to compute on.

Returns
Column

the column for computed results.

Examples

>>> spark.createDataFrame([('ABC',)], ['a']).select(md5('a').alias('hash')).collect()
[Row(hash='902fbdd2b1df0c4f70b4a5d23525e932')]