You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Shuai Zheng (JIRA)" <ji...@apache.org> on 2015/04/21 21:43:58 UTC

[jira] [Commented] (SPARK-7039) JdbcRdd doesn't support java.sql.Types.NVARCHAR

    [ https://issues.apache.org/jira/browse/SPARK-7039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14505597#comment-14505597 ] 

Shuai Zheng commented on SPARK-7039:
------------------------------------

I have created a pull request.

And the related code:

JDBCRDD.scala:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala

java.sql.Types:
http://docs.oracle.com/javase/7/docs/api/java/sql/Types.html

> JdbcRdd doesn't support java.sql.Types.NVARCHAR
> -----------------------------------------------
>
>                 Key: SPARK-7039
>                 URL: https://issues.apache.org/jira/browse/SPARK-7039
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.3.1
>         Environment: Spark 1.3.1
>            Reporter: Shuai Zheng
>            Priority: Minor
>             Fix For: 1.3.2, 1.4.0
>
>
> When create a DataFrame from jdbc method through SqlContext:
> DataFrame df = sql.jdbc(url, fullTableName);
> If there is column type NVARCHAR, below exception will be thrown:
> Caused by: java.sql.SQLException: Unsupported type -9
> 	at org.apache.spark.sql.jdbc.JDBCRDD$.getCatalystType(JDBCRDD.scala:78)
> 	at org.apache.spark.sql.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:112)
> 	at org.apache.spark.sql.jdbc.JDBCRelation.<init>(JDBCRelation.scala:133)
> 	at org.apache.spark.sql.SQLContext.jdbc(SQLContext.scala:900)
> 	at org.apache.spark.sql.SQLContext.jdbc(SQLContext.scala:852)
> ====================================================
> When comparing the code between JDBCRDD.scala and java.sql.Types.java, the only type is not supported in JDBCRDD.scala is NVARCHAR. 
> Because NCHAR is supported, so I think this is just a small mistake that people skip this type instead of ignore it intentionally. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org