<?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 Re: Databricks SQL Exists does not work correct? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113225#M44473</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/23391"&gt;@sergecom&lt;/a&gt;&amp;nbsp;This looks to be a possible bug, thank you for flagging. It looks like the EXISTS function works as intended with Serverless Compute and Serverless SQL Warehouses, but exhibits a different behavior when run on all-purpose compute. I've raised a ticket so that they can look into this.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2025 22:35:08 GMT</pubDate>
    <dc:creator>Shua42</dc:creator>
    <dc:date>2025-03-20T22:35:08Z</dc:date>
    <item>
      <title>Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113119#M44428</link>
      <description>&lt;P&gt;Can someone explain to me how this is possible?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sergecom_0-1742460269477.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/15517i9B7AA47D7CC857AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sergecom_0-1742460269477.png" alt="Sergecom_0-1742460269477.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sergecom_1-1742460306964.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/15518i428084A98C6F1DE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sergecom_1-1742460306964.png" alt="Sergecom_1-1742460306964.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 09:08:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113119#M44428</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-20T09:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113215#M44471</link>
      <description>&lt;P&gt;I replicated the query exactly but I couldn't produce the same results, and got back the expected result of the single row with 'aaa'. My initial thought is that it could be a bug in the runtime. Can you share the runtime of the cluster you are using?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 21:11:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113215#M44471</guid>
      <dc:creator>Shua42</dc:creator>
      <dc:date>2025-03-20T21:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113218#M44472</link>
      <description>&lt;P&gt;Thanks for your reply &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154481"&gt;@Shua42&lt;/a&gt;&amp;nbsp;!&lt;BR /&gt;I use 15.4 LTS&lt;BR /&gt;Here is the summary of cluster configuration:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sergecom_0-1742506166174.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/15545i89DC41015BDB5F57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sergecom_0-1742506166174.png" alt="Sergecom_0-1742506166174.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 21:30:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113218#M44472</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-20T21:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113225#M44473</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/23391"&gt;@sergecom&lt;/a&gt;&amp;nbsp;This looks to be a possible bug, thank you for flagging. It looks like the EXISTS function works as intended with Serverless Compute and Serverless SQL Warehouses, but exhibits a different behavior when run on all-purpose compute. I've raised a ticket so that they can look into this.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 22:35:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113225#M44473</guid>
      <dc:creator>Shua42</dc:creator>
      <dc:date>2025-03-20T22:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113257#M44484</link>
      <description>&lt;P&gt;Thanks for the update!&amp;nbsp; Let me know if you need any more details from my side—happy to help.&lt;BR /&gt;Is there any way to follow this ticket &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154481"&gt;@Shua42&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 05:11:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113257#M44484</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-21T05:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113260#M44485</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We were able to reproduce the problem, but it only occurs in Databricks SQL version 2025.10. With version 2024.05, the correct result is obtained.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 07:55:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113260#M44485</guid>
      <dc:creator>marco1995</dc:creator>
      <dc:date>2025-03-21T07:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113265#M44489</link>
      <description>&lt;P&gt;Thanks for feedback &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/7782"&gt;@Marco&lt;/a&gt;I've also tested with an older All-purpose Runtime 12.2 LTS and it works.&lt;BR /&gt;But its alarming that the latest runtime does not work as expected.&lt;BR /&gt;&lt;BR /&gt;I will post SQL code so it will be easier for other to test. Both these queries give wrong results:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%sql&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WITH&lt;/SPAN&gt;&lt;SPAN&gt; a &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;'aaa'&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; produktkod &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN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lt;SPAN&gt; a.&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; a&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WHERE&lt;/SPAN&gt; &lt;SPAN&gt;exists&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;select&lt;/SPAN&gt; &lt;SPAN&gt;1&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; b &lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt; &lt;SPAN&gt;a&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;produktkod&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;b&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;produktkod&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;%sql&lt;BR /&gt;WITH a AS (&lt;BR /&gt;SELECT 'aaa' as produktkod&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT 'bbb' as produktkod&lt;BR /&gt;),&lt;BR /&gt;b AS (&lt;BR /&gt;SELECT 'aaa' as produktkod&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT 'ccc' as produktkod&lt;BR /&gt;)&lt;BR /&gt;SELECT a.*,&lt;BR /&gt;(SELECT COUNT(1)&lt;BR /&gt;FROM b&lt;BR /&gt;WHERE b.produktkod = a.produktkod) as match_count&lt;BR /&gt;FROM a;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 21 Mar 2025 09:14:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113265#M44489</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-21T09:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113334#M44507</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/23391"&gt;@sergecom&lt;/a&gt;&amp;nbsp;The engineering team worked on this and I believe it is now resolved for the newer runtimes. I confirmed it nows works as expected on 16.2. Can you confirm if it works on your end?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 22:02:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113334#M44507</guid>
      <dc:creator>Shua42</dc:creator>
      <dc:date>2025-03-21T22:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113431#M44529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154481"&gt;@Shua42&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I can confirm that the EXISTS/NOT EXISTS query is working as expected now in the 15.4 LTS . Thank you for fixing it so quickly!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sergecom_0-1742827803252.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/15583iA5EA98D769B4CCD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sergecom_0-1742827803252.png" alt="Sergecom_0-1742827803252.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But the subquery issue still NOT fixed. Before I was getting two rows (that is incorrect). Now I'm getting an error:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sergecom_1-1742827945663.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/15585iEAE2AB4BE258A743/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sergecom_1-1742827945663.png" alt="Sergecom_1-1742827945663.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 14:52:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113431#M44529</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-24T14:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks SQL Exists does not work correct?</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113485#M44551</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154481"&gt;@Shua42&lt;/a&gt;&amp;nbsp;I've realized that I didn’t mention the subquery issue in my first post, so I guess this can be handled as a separate ticket.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 09:46:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-sql-exists-does-not-work-correct/m-p/113485#M44551</guid>
      <dc:creator>sergecom</dc:creator>
      <dc:date>2025-03-25T09:46:42Z</dc:date>
    </item>
  </channel>
</rss>

