<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hashing Functions in PySpark in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/hashing-functions-in-pyspark/m-p/49181#M28491</link>
    <description>&lt;P&gt;&lt;FONT size="4"&gt;Hashes are commonly used in SCD2 merges to determine&amp;nbsp;whether data has changed by comparing the hashes of the new rows in the source with the hashes of the existing rows in the target table.&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="4"&gt;PySpark offers multiple different hashing functions like:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="3"&gt;MD5 (pyspark.sql.functions.md5)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;SHA1 (pyspark.sql.functions.sha1)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;SHA2 (pyspark.sql.functions.sha2)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;xxHASH64 (pyspark.sql.functions.xxhash64)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;32 bit HASH (pyspark.sql.functions.hash)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Crc32 (pyspark.sql.functions.crc32)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3"&gt;Which one of those are best suited for implementing a comparison between source table and target table rows in a SCD2-type merge in terms of robustness, performance and collision likelihood?&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2023 16:48:08 GMT</pubDate>
    <dc:creator>Michael_Appiah</dc:creator>
    <dc:date>2023-10-14T16:48:08Z</dc:date>
    <item>
      <title>Hashing Functions in PySpark</title>
      <link>https://community.databricks.com/t5/data-engineering/hashing-functions-in-pyspark/m-p/49181#M28491</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;Hashes are commonly used in SCD2 merges to determine&amp;nbsp;whether data has changed by comparing the hashes of the new rows in the source with the hashes of the existing rows in the target table.&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="4"&gt;PySpark offers multiple different hashing functions like:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="3"&gt;MD5 (pyspark.sql.functions.md5)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;SHA1 (pyspark.sql.functions.sha1)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;SHA2 (pyspark.sql.functions.sha2)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;xxHASH64 (pyspark.sql.functions.xxhash64)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;32 bit HASH (pyspark.sql.functions.hash)&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Crc32 (pyspark.sql.functions.crc32)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3"&gt;Which one of those are best suited for implementing a comparison between source table and target table rows in a SCD2-type merge in terms of robustness, performance and collision likelihood?&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 16:48:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/hashing-functions-in-pyspark/m-p/49181#M28491</guid>
      <dc:creator>Michael_Appiah</dc:creator>
      <dc:date>2023-10-14T16:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hashing Functions in PySpark</title>
      <link>https://community.databricks.com/t5/data-engineering/hashing-functions-in-pyspark/m-p/49402#M28549</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thank you for your comprehensive answer. What is your opinion on the trade-off between using a hash like &lt;SPAN&gt;xxHASH64 which returns a LongType column and thus would offer good performance when there is a need to join on the hash column versus using a more robust/secure algorithm like the SHA2 which however returns a StringType column which would be slower when performing joins?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 16:19:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/hashing-functions-in-pyspark/m-p/49402#M28549</guid>
      <dc:creator>Michael_Appiah</dc:creator>
      <dc:date>2023-10-17T16:19:30Z</dc:date>
    </item>
  </channel>
</rss>

