<?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: Spark Settings in SQL Warehouse in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7961#M3695</link>
    <description>&lt;P&gt;Hi @Nicholas Mead​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Apr 2023 00:15:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-04-01T00:15:38Z</dc:date>
    <item>
      <title>Spark Settings in SQL Warehouse</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7959#M3693</link>
      <description>&lt;P&gt;I'm running a query, trying to parse a string into a map, and I get the following error;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;org.apache.spark.SparkRuntimeException: Duplicate map key  was found, please check the input data. If you want to remove the duplicated keys, you can set "spark.sql.mapKeyDedupPolicy" to "LAST_WIN" so that the key inserted at last takes precedence.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No worries, so I try to alter this setting;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;set spark.sql.mapKeyDedupPolicy=LAST_WIN&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And get the following error;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Error running query: org.apache.spark.sql.AnalysisException: Configuration spark.sql.mapKeyDedupPolicy is not available.:155:154, &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This works when using a general purpose cluster, but doesn't work when using a SQL Warehouse.  So how do I change this setting in a SQL Warehouse cluster?  And if that's not possible, how do I get around this error?x&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 11:30:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7959#M3693</guid>
      <dc:creator>najmead</dc:creator>
      <dc:date>2023-03-10T11:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Settings in SQL Warehouse</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7960#M3694</link>
      <description>&lt;P&gt;@Maryam Najafian​&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason why you are getting this error is that the spark.sql.mapKeyDedupPolicy configuration is not available in SQL Warehouse clusters. This configuration is specific to Spark clusters and is not supported in SQL Warehouse.&lt;/P&gt;&lt;P&gt;To work around this error, you can try using an alternative approach to parsing the string into a map. One approach is to split the string into an array of key-value pairs, and then use the map_from_arrays function to convert the array into a map. Here's an example: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT map_from_arrays(
    transform(
        split('key1:value1,key2:value2,key3:value3', ','), 
        x -&amp;gt; split(x, ':')
    )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this example, we first split the input string into an array of key-value pairs using the split function. We then transform this array to create an array of arrays, where each inner array contains two elements (the key and value). Finally, we use the map_from_arrays function to create a map from the array of arrays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that this approach assumes that the input string is well-formed and does not contain duplicate keys. If the input data may contain duplicate keys, you can add additional logic to handle this case, such as using the array_distinct function to remove duplicate keys before converting the array to a map.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 15:46:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7960#M3694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-17T15:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Settings in SQL Warehouse</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7961#M3695</link>
      <description>&lt;P&gt;Hi @Nicholas Mead​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 00:15:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-settings-in-sql-warehouse/m-p/7961#M3695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-01T00:15:38Z</dc:date>
    </item>
  </channel>
</rss>

