<?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 Warehouse: Retrieving SQL ARRAY Type via JDBC driver in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/65861#M32942</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;many thanks for your response. I followed your proposed steps to resolve the issue&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;We use the latest released driver version which is 2.6.36:&amp;nbsp;&lt;A href="https://www.databricks.com/spark/jdbc-drivers-archive" target="_blank"&gt;https://www.databricks.com/spark/jdbc-drivers-archive&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;yes. this is indeed the issue: not an ARRAY is returned but a VARCHAR type&lt;/LI&gt;&lt;LI&gt;Unfortunately with explicitely defining the result name does not change the resulting type. I don´t see that the expected data type is specified with adding &lt;STRONG&gt;AS result_value&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Unfortunately nothing changed&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Does the underlying Simba Driver support complex types such as ARRAY?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2024 07:30:13 GMT</pubDate>
    <dc:creator>wilco</dc:creator>
    <dc:date>2024-04-09T07:30:13Z</dc:date>
    <item>
      <title>SQL Warehouse: Retrieving SQL ARRAY Type via JDBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/65560#M32841</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;we are currently running into the following issue&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;we are using serverless SQL warehouse&lt;/LI&gt;&lt;LI&gt;in a JAVA application we are using the latest Databricks JDBC driver (v&lt;SPAN&gt;2.6.36)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;we are querying the warehouse with a collect_list function, which should return an ARRAY type&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;but instead we are getting a Json List as String&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;We are trying the query which is mentioned in the &lt;A href="https://docs.databricks.com/en/sql/language-manual/functions/collect_list.html" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT collect_list(col) FROM VALUES (1), (2), (NULL), (1) AS tab(col);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The MetaData instance of the ResultSet instance indicates that the java.sql.Types constant for the retrieved column is VARCHAR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;String query = "SELECT collect_list(col) result_value FROM VALUES (1), (1), (NULL), (2) AS tab(col)";
ResultSet resultSet = connection.createStatement().executeQuery(query);
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
int columnType = resultSetMetaData.getColumnType(1);
// columnType equals java.sql.Types.VARCHAR with int value == 12&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running the same query in the Databricks SQL Editor in the browser returns the correct type (of course).&lt;/P&gt;&lt;P&gt;Any idea how to get the array type with using the JDBC driver?&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 07:40:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/65560#M32841</guid>
      <dc:creator>wilco</dc:creator>
      <dc:date>2024-04-05T07:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Warehouse: Retrieving SQL ARRAY Type via JDBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/65861#M32942</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;many thanks for your response. I followed your proposed steps to resolve the issue&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;We use the latest released driver version which is 2.6.36:&amp;nbsp;&lt;A href="https://www.databricks.com/spark/jdbc-drivers-archive" target="_blank"&gt;https://www.databricks.com/spark/jdbc-drivers-archive&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;yes. this is indeed the issue: not an ARRAY is returned but a VARCHAR type&lt;/LI&gt;&lt;LI&gt;Unfortunately with explicitely defining the result name does not change the resulting type. I don´t see that the expected data type is specified with adding &lt;STRONG&gt;AS result_value&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Unfortunately nothing changed&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Does the underlying Simba Driver support complex types such as ARRAY?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 07:30:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/65861#M32942</guid>
      <dc:creator>wilco</dc:creator>
      <dc:date>2024-04-09T07:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Warehouse: Retrieving SQL ARRAY Type via JDBC driver</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/71386#M34302</link>
      <description>&lt;P&gt;Hey Wilco,&lt;/P&gt;
&lt;P&gt;The answer is no, ODBC/JDBC don't support complex types so these need to be compressed into strings over the wire (usually in JSON representation) and rehydrated on the client side into a complex object.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 04:02:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-warehouse-retrieving-sql-array-type-via-jdbc-driver/m-p/71386#M34302</guid>
      <dc:creator>KTheJoker</dc:creator>
      <dc:date>2024-06-03T04:02:05Z</dc:date>
    </item>
  </channel>
</rss>

