Hi all,
we are currently running into the following issue
- we are using serverless SQL warehouse
- in a JAVA application we are using the latest Databricks JDBC driver (v2.6.36)
- we are querying the warehouse with a collect_list function, which should return an ARRAY type
- but instead we are getting a Json List as String
We are trying the query which is mentioned in the documentation
SELECT collect_list(col) FROM VALUES (1), (2), (NULL), (1) AS tab(col);
The MetaData instance of the ResultSet instance indicates that the java.sql.Types constant for the retrieved column is VARCHAR.
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
Running the same query in the Databricks SQL Editor in the browser returns the correct type (of course).
Any idea how to get the array type with using the JDBC driver?
Many thanks in advance!