<?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 bitmap_count() function's output is different in databricks compared to snowflake in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/bitmap-count-function-s-output-is-different-in-databricks/m-p/54890#M1939</link>
    <description>&lt;P&gt;I have found that the results of the bitmap_count() function output differs significantly between databricks and snowflake.&lt;/P&gt;&lt;P&gt;eg: snowflake returns a value of '1' for this code. "select bitmap_count(X'0001056c000000000000') "&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vigneshp_1-1701992518337.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5532i6E810A7BF2A67477/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="vigneshp_1-1701992518337.png" alt="vigneshp_1-1701992518337.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while&amp;nbsp; Databricks returns a value of '7' .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vigneshp_0-1701992493192.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5531iA39C20BAEC0F4FE1/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="vigneshp_0-1701992493192.png" alt="vigneshp_0-1701992493192.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does anyone know the reason for this difference? Am I doing anything wrong here? This is part of a migration project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similar to the bitmap_count() function , the&amp;nbsp;&lt;SPAN&gt;bitmap_or_agg() function also works differently, it databricks it pads a lot of zeroes at the end.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2023 23:43:00 GMT</pubDate>
    <dc:creator>vigneshp</dc:creator>
    <dc:date>2023-12-07T23:43:00Z</dc:date>
    <item>
      <title>bitmap_count() function's output is different in databricks compared to snowflake</title>
      <link>https://community.databricks.com/t5/get-started-discussions/bitmap-count-function-s-output-is-different-in-databricks/m-p/54890#M1939</link>
      <description>&lt;P&gt;I have found that the results of the bitmap_count() function output differs significantly between databricks and snowflake.&lt;/P&gt;&lt;P&gt;eg: snowflake returns a value of '1' for this code. "select bitmap_count(X'0001056c000000000000') "&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vigneshp_1-1701992518337.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5532i6E810A7BF2A67477/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="vigneshp_1-1701992518337.png" alt="vigneshp_1-1701992518337.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while&amp;nbsp; Databricks returns a value of '7' .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vigneshp_0-1701992493192.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5531iA39C20BAEC0F4FE1/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="vigneshp_0-1701992493192.png" alt="vigneshp_0-1701992493192.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does anyone know the reason for this difference? Am I doing anything wrong here? This is part of a migration project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similar to the bitmap_count() function , the&amp;nbsp;&lt;SPAN&gt;bitmap_or_agg() function also works differently, it databricks it pads a lot of zeroes at the end.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 23:43:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/bitmap-count-function-s-output-is-different-in-databricks/m-p/54890#M1939</guid>
      <dc:creator>vigneshp</dc:creator>
      <dc:date>2023-12-07T23:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: bitmap_count() function's output is different in databricks compared to snowflake</title>
      <link>https://community.databricks.com/t5/get-started-discussions/bitmap-count-function-s-output-is-different-in-databricks/m-p/61411#M2673</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/95887"&gt;@vigneshp&lt;/a&gt;&amp;nbsp;, Good Day!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Databricks, bitmap_count function returns the number of bits set in a BINARY string representing a bitmap. This function is typically used to count distinct values in combination with the bitmap_bucket_number() and the bitmap_construct_agg() functions.&lt;/P&gt;
&lt;P&gt;For more details about this function, you can refer to this document :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/functions/bitmap_count.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/functions/bitmap_count.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please let me know if this helps and leave a like if this information is useful, followups are appreciated.&lt;BR /&gt;Kudos&lt;BR /&gt;Ayushi&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 05:47:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/bitmap-count-function-s-output-is-different-in-databricks/m-p/61411#M2673</guid>
      <dc:creator>Ayushi_Suthar</dc:creator>
      <dc:date>2024-02-22T05:47:57Z</dc:date>
    </item>
  </channel>
</rss>

