xxhash64

xxHash algoritmasının 64 bit değişkenini kullanarak verilen sütunların karma kodunu hesaplar ve sonucu uzun bir sütun olarak döndürür. Karma hesaplama ilk 42 tohumunu kullanır. Spark Connect'i destekler.

İlgili Databricks SQL fonksiyonu için bakınız xxhash64 fonksiyonu.

Sözdizimi

from pyspark.sql import functions as dbf

dbf.xxhash64(*cols)

Parametreler

Parametre Türü Description
cols pyspark.sql.Column veya str İşlem için bir veya daha fazla sütun.

İade

pyspark.sql.Column: uzun sütun olarak karma değeri.

Örnekler

Örnek 1: Tek bir sütunun xxhash64 değerini hesaplama

from pyspark.sql import functions as dbf
df = spark.createDataFrame([('ABC', 'DEF')], ['c1', 'c2'])
df.select('*', dbf.xxhash64('c1')).show()
+---+---+-------------------+
| c1| c2|       xxhash64(c1)|
+---+---+-------------------+
|ABC|DEF|4105715581806190027|
+---+---+-------------------+

Örnek 2: Birden çok sütunun xxhash64 değerini hesaplama

from pyspark.sql import functions as dbf
df = spark.createDataFrame([('ABC', 'DEF')], ['c1', 'c2'])
df.select('*', dbf.xxhash64('c1', df.c2)).show()
+---+---+-------------------+
| c1| c2|   xxhash64(c1, c2)|
+---+---+-------------------+
|ABC|DEF|3233247871021311208|
+---+---+-------------------+