Átomo
106Hs
UDF e funções · Spark

sha2 / md5 / xxhash64

Abrir na tabela

Definição

Geram um hash a partir de valores. Usados em chaves substitutas e na deteção de mudança de linha.

Exemplos

1. Hash da linha
df = df.withColumn("row_hash",
    F.sha2(F.concat_ws("|", "name", "email", "city"), 256))
2. Chave substituta
df = df.withColumn("hk_inventory",
    F.md5(F.concat_ws("|", "store_id", "product_id")))
3. Hash numérico rápido
df = df.withColumn("hk", F.xxhash64("store_id", "product_id"))

No mesmo grupo