[ 
https://issues.apache.org/jira/browse/SPARK-16848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon updated SPARK-16848:
---------------------------------
    Description: 
Currently,

Both APIs below:

{code}
spark.read.schema(StructType(Nil)).jdbc(...)
{code}

 and 

{code}
spark.read.schema(StructType(Nil)).table("usrdb.test")
{code}

ignore schemas.

It'd make sense to throw an exception rather than causing confusion to users.


  was:
Currently,

{code}
spark.read.schema(StructType(Seq())).jdbc(...),show()
{code}

does not throws an exception whereas

{code}
spark.read.schema(StructType(Seq())).option(...).format("jdbc").load().show()
{code}

does as below:

{code}
jdbc does not allow user-specified schemas.;
org.apache.spark.sql.AnalysisException: jdbc does not allow user-specified 
schemas.;
        at 
org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:320)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:149)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:122)
        at 
org.apache.spark.sql.jdbc.JDBCSuite$$anonfun$17.apply$mcV$sp(JDBCSuite.scala:351)
{code}

It'd make sense throwing the exception when user specifies schema identically.


> Check schema validation for user-specified schema in jdbc and table APIs
> ------------------------------------------------------------------------
>
>                 Key: SPARK-16848
>                 URL: https://issues.apache.org/jira/browse/SPARK-16848
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Hyukjin Kwon
>            Priority: Trivial
>
> Currently,
> Both APIs below:
> {code}
> spark.read.schema(StructType(Nil)).jdbc(...)
> {code}
>  and 
> {code}
> spark.read.schema(StructType(Nil)).table("usrdb.test")
> {code}
> ignore schemas.
> It'd make sense to throw an exception rather than causing confusion to users.



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

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

Reply via email to