snowflakedb / snowflake-jdbc

Snowflake JDBC Driver
Apache License 2.0
170 stars 156 forks source link

SNOW-1479614: No enum constant net.snowflake.client.jdbc.SnowflakeType. #1790

Open akashkhamkarr opened 2 weeks ago

akashkhamkarr commented 2 weeks ago

Please answer these questions before submitting your issue. In order to accurately debug the issue this information is required. Thanks!

  1. What version of JDBC driver are you using? 3.16.1

  2. What operating system and processor architecture are you using? NA

  3. What version of Java are you using? 11

  4. What did you do? a. Fetched database columns using connection.metaData.getColumns(databaseName, null, null, null) b. Kept iterating over the rs jdbcResultSet, during which i called rs.next() to check if any more rows are left. c. Here i got the exception No enum constant net.snowflake.client.jdbc.SnowflakeType.

For the time being, we can't check the actual column data type on the snowflake, for which this has happened

Relevant stacktrace:

Exception in thread "main" java.lang.IllegalArgumentException: No enum constant net.snowflake.client.jdbc.SnowflakeType.
        at java.base/java.lang.Enum.valueOf(Unknown Source)
        at net.snowflake.client.jdbc.SnowflakeType.valueOf(SnowflakeType.java:23)
        at net.snowflake.client.jdbc.SnowflakeType.fromString(SnowflakeType.java:54)
        at net.snowflake.client.jdbc.SnowflakeUtil.getSnowflakeType(SnowflakeUtil.java:236)
        at net.snowflake.client.jdbc.SnowflakeUtil.createFieldsMetadata(SnowflakeUtil.java:404)
        at net.snowflake.client.jdbc.SnowflakeUtil.getFieldMetadata(SnowflakeUtil.java:437)
        at net.snowflake.client.jdbc.SnowflakeUtil.extractColumnMetadata(SnowflakeUtil.java:191)
        at net.snowflake.client.jdbc.SnowflakeDatabaseMetaData$4.next(SnowflakeDatabaseMetaData.java:1819)

I believe the datatype being received is empty

  1. What did you expect to see? a. either a default datatype value to get assign to such empty fields, or a proper parsing of the correct datatype

  2. Can you set logging to DEBUG and collect the logs? a. Can try if required https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

  3. What is your Snowflake account identifier, if any? (Optional) NA

sfc-gh-wfateem commented 2 weeks ago

Hi @akashkhamkarr,

Thanks for creating the issue. Is there anything else you can do to try and narrow down the problem? For example, is it feasible for you to run that test on specific tables, or schemas at least? Was this working on a version older than 3.16.1, or did you just happen to run this code starting with that version? In the meantime, I'll take a look to see what I can figure out based on that error stack you shared.

akashkhamkarr commented 2 weeks ago

@sfc-gh-wfateem Hi, i was able to figure out for which data type its happening

So far its happening over the structured objects columns

steps to reproduce

  1. Create an iceberg table with a structured object column (not normal object, it needs to be a structured object)
  2. Try fetching columns for the parent database, using .getColumns(databaseName, null, null, null)
akashkhamkarr commented 1 week ago

@sfc-gh-wfateem any updates on this ?