Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1844765: java.lang.IllegalArgumentException: No enum constant java.sql.JDBCType.varchar when writing an ARRAY value #1982

Open
jneira-stratio opened this issue Dec 4, 2024 · 3 comments
Assignees
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@jneira-stratio
Copy link

jneira-stratio commented Dec 4, 2024

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?

Version 3.20.0

  1. What operating system and processor architecture are you using?

N/A, but linux

  1. What version of Java are you using?

openjdk version "1.8.0_432"
OpenJDK Runtime Environment (build 1.8.0_432-8u432-gaus1-0ubuntu220.04-ga)
OpenJDK 64-Bit Server VM (build 25.432-bga, mixed mode)

  1. What did you do?
  • Run a test which uses spark to write in a column with type ARRAY an array of one element of type VARCHAR (or any other inner type)
  1. What did you expect to see?
  • The write is succesful even if the method is called with a lower case type name

    What should have happened and what happened instead?

  • The code throws an error

java.lang.IllegalArgumentException: No enum constant java.sql.JDBCType.varchar
	at java.lang.Enum.valueOf(Enum.java:238)
	at java.sql.JDBCType.valueOf(JDBCType.java:34)
	at net.snowflake.client.jdbc.SnowflakeConnectionV1.createArrayOf(SnowflakeConnectionV1.java:725)
	at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.$anonfun$makeSetter$15(JdbcUtils.scala:589)
	at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.$anonfun$makeSetter$15$adapted(JdbcUtils.scala:586)
  1. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

    Before sharing any information, please be sure to review the log and remove any sensitive
    information.

I think the stacktrace is informative enough and the cause is clear:

Would be it possible to make a defensive toUpperCase call before getting the JDBCType and add support for those spark versions (the current one is 3.5)?

Many thanks in advance

@github-actions github-actions bot changed the title java.lang.IllegalArgumentException: No enum constant java.sql.JDBCType.varchar when writing an ARRAY value SNOW-1844765: java.lang.IllegalArgumentException: No enum constant java.sql.JDBCType.varchar when writing an ARRAY value Dec 4, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage_done Initial triage done, will be further handled by the driver team label Dec 11, 2024
@sfc-gh-dszmolka
Copy link
Contributor

hi - thanks for reporting this and also the analysis. we'll take a look.

@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Dec 19, 2024

addressed in #2010 - under review
edit: today it was already merged :) so now it's waiting for release.

@sfc-gh-dszmolka sfc-gh-dszmolka added the status-pr_pending_merge A PR is made and is under review label Dec 19, 2024
@jneira-stratio
Copy link
Author

thanks a lot!

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-pr_pending_merge A PR is made and is under review labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

3 participants