pyspark.sql.functions.hash

pyspark.sql.functions.hash(*cols: ColumnOrName) → pyspark.sql.column.Column

Calculates the hash code of given columns, and returns the result as an int column.

Examples

>>> spark.createDataFrame([('ABC',)], ['a']).select(hash('a').alias('hash')).collect()
[Row(hash=-757602832)]