<?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: SQL run on cluster creates table different to SQL Warehouse endpoint in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101748#M40806</link>
    <description>&lt;P&gt;This should not be expected as both compute types should support the coalesce. Have you tried the same in clusters with other DBRs to confirm if this is only related to 15.4 or if is happening with any runtime?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 11:43:15 GMT</pubDate>
    <dc:creator>Walter_C</dc:creator>
    <dc:date>2024-12-11T11:43:15Z</dc:date>
    <item>
      <title>SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101674#M40771</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a Personal cluster version&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;15.4 LTS (includes Apache Spark 3.5.0, Scala 2.12) and a SQL Warehouse in a databricks environment.&amp;nbsp; When I use the following code to create a table in a catalog, it gives me different column types when run on the cluster vs the warehouse:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;%sql
create or replace table [catalog].[schema].[test_table_name] 
using delta
comment 'This has a comment'
as
select 
  id, 
  name as new_name,
  created_date as new_created_date,
  current_timestamp() as test_timestamp,
  coalesce(name,'Replaced name') as test_coalesce_name,
  coalesce(id,'-1') as test_coalesce_id,
  coalesce(created_date,'2024-12-11') as test_coalesce_date
from (
  select 
    cast(col1 as int) as id, 
    cast(col2 as string) as name, 
    cast(col3 as date) as created_date
  from VALUES
  (1, 'Alice', '2024-12-01'),
  (2, 'Bob', '2024-12-02'),
  (3, 'Charlie', '2024-12-03'),
  (4, 'David', '2024-12-04'),
  (5, 'Eve', '2024-12-05'),
  (6, 'Frank', '2024-12-06'),
  (7, 'Grace', '2024-12-07'),
  (8, 'Hank', '2024-12-08'),
  (9, 'Ivy', '2024-12-09'),
  (10, 'Jack', '2024-12-10'),
  (11, NULL, '2024-12-11'),
  (NULL, 'NULL Values', NULL)
) as temp_table&lt;/PRE&gt;&lt;P&gt;When&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;running on a SQL warehouse, the column types for the coalesce'd columns are resolved correctly. However, when running on a cluster, they are not resolved and are converted to strings.&amp;nbsp; Is this expected behaviour?&lt;/P&gt;&lt;P&gt;Have tried on two different databricks environments and have the same result.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 03:23:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101674#M40771</guid>
      <dc:creator>blobbles78</dc:creator>
      <dc:date>2024-12-11T03:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101748#M40806</link>
      <description>&lt;P&gt;This should not be expected as both compute types should support the coalesce. Have you tried the same in clusters with other DBRs to confirm if this is only related to 15.4 or if is happening with any runtime?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 11:43:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101748#M40806</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-11T11:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101751#M40809</link>
      <description>&lt;P&gt;I have tried with Databricks Runtimes of 14.3 and 16.0 with the same results. I wouldn't like to use anything prior to 14.3, so don't want to try earlier versions.&amp;nbsp; Remember the computes all support the coalesce, its just that using it with a DBR instead of a SQL warehouse compute, the coalesce causes different behaviour. Specifically it stops respecting data types coming through the coalesce when using a DBR.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 11:56:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101751#M40809</guid>
      <dc:creator>blobbles78</dc:creator>
      <dc:date>2024-12-11T11:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101754#M40812</link>
      <description>&lt;P&gt;Appreciate your testing, I will check internally on this and will get back to you.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 12:01:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101754#M40812</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-11T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101811#M40840</link>
      <description>&lt;P&gt;Can you try to set spark config&amp;nbsp;&lt;SPAN&gt;spark.sql.ansi.enabled true in the cluster and test back?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 18:30:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101811#M40840</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-11T18:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101822#M40849</link>
      <description>&lt;P&gt;Yes, that seems to work! So in order to get the same behaviour for our clusters compared to our SQL Warehouse, we have to ensure the spark setting&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;spark.sql.ansi.enabled=true? That seems like a setting that should default to be true, is there a reason it is defaulting to false?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 19:43:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101822#M40849</guid>
      <dc:creator>blobbles78</dc:creator>
      <dc:date>2024-12-11T19:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: SQL run on cluster creates table different to SQL Warehouse endpoint</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101827#M40852</link>
      <description>&lt;P&gt;It seems that as per docs as of now this setting is only true by default in warehouses in clusters it is set to false:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-ansi-compliance.html#ansi-compliance-in-databricks-runtime" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-ansi-compliance.html#ansi-compliance-in-databricks-runtime&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 20:54:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-run-on-cluster-creates-table-different-to-sql-warehouse/m-p/101827#M40852</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-11T20:54:27Z</dc:date>
    </item>
  </channel>
</rss>

