You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Javier Neira Sanchez (Jira)" <ji...@apache.org> on 2024/12/04 08:47:00 UTC
[jira] [Comment Edited] (SPARK-50488) `No enum constant java.sql.JDBCType.varchar` error writing array values
[ https://issues.apache.org/jira/browse/SPARK-50488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17902920#comment-17902920 ]
Javier Neira Sanchez edited comment on SPARK-50488 at 12/4/24 8:46 AM:
-----------------------------------------------------------------------
Hmm i guess the reason was the jdbc driver for postgres requires the string to lower case: [https://github.com/pgjdbc/pgjdbc/blob/187b90681dbceddea2cbffded9dcdc4bf95ddacb/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L95]
But it seems it tries to get it making a toLowerCase (at least nowadays):
https://github.com/pgjdbc/pgjdbc/blob/187b90681dbceddea2cbffded9dcdc4bf95ddacb/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L786
was (Author: jneira):
Hmm i guess the reason was the jdbc driver for postgres requires the string to lower case: [https://github.com/pgjdbc/pgjdbc/blob/187b90681dbceddea2cbffded9dcdc4bf95ddacb/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L95] :(
> `No enum constant java.sql.JDBCType.varchar` error writing array values
> -----------------------------------------------------------------------
>
> Key: SPARK-50488
> URL: https://issues.apache.org/jira/browse/SPARK-50488
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.1.3, 3.2.4, 3.3.4, 3.4.3, 3.5.3
> Reporter: Javier Neira Sanchez
> Priority: Minor
> Fix For: 4.0.0
>
>
> Hi, the code which tries to write a value of type Array[TYPE] converts the type name of the inner type to lower case since the feature wad added:
> * [https://github.com/apache/spark/pull/14323/files#diff-c3859e97335ead4b131263565c987d877bea0af3adbd6c5bf2d3716768d2e083R217]
>
> The conversion to lower case has been removed in master afaics:
> * [https://github.com/apache/spark/blob/0e45e217996248a093cfcb892407bb523f885c08/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala#L707]
> * [https://github.com/apache/spark/blob/0e45e217996248a093cfcb892407bb523f885c08/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala#L714]
>
> So i assume the conversin to lower case is not needed (i wonder why it was added)
>
> That conversion to lower case makes jdbc drivers (in this case snowfalke jdbc driver) fails in connection.createArrayOf code when trying to get a value of JDBCType enum using that type name:
>
> ```
> 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)
> ```
> So i would remove the call toLowerCase in prior versions to master, at least 3.5.
>
> Many thanks in advance!
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org