snowflakedb/snowflake-jdbc

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

Closed this issue · 7 comments

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

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.

@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)

@sfc-gh-wfateem any updates on this ?

Hi @akashkhamkarr,

I apologize for the delay. I've been out for a while and just getting back to my backlog.
I just looked over this, and I was able to reproduce the issue. I'll discuss this with the rest of the team to try to address it as soon as possible. Thanks for your patience.

@akashkhamkarr PR #1831 is merged and will fix this issue in the next release.
Thanks for your patience!

Awesome, thank you @sfc-gh-wfateem

@akashkhamkarr JDBC driver version 3.18.0 has been released with the fix for this issue.
Please give that a try and let us know if you still have any issues with this.
I will go ahead and close this issue for now.