You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2015/04/24 02:46:39 UTC

[jira] [Updated] (SPARK-6408) JDBCRDD fails on where clause with string literal

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

Sean Owen updated SPARK-6408:
-----------------------------
    Assignee: Pei-Lun Lee

> JDBCRDD fails on where clause with string literal
> -------------------------------------------------
>
>                 Key: SPARK-6408
>                 URL: https://issues.apache.org/jira/browse/SPARK-6408
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.3.0
>            Reporter: Pei-Lun Lee
>            Assignee: Pei-Lun Lee
>            Priority: Blocker
>             Fix For: 1.3.1, 1.4.0
>
>
> The generated SQL query string is incorrect on filtering string literals.
> {code}where foo='bar'{code} results in {code}where foo=bar{code}
> The following snippet reproduce the bug:
> {code}
> $ SPARK_CLASSPATH=h2-1.4.186.jar spark/bin/spark-shell
> import java.sql.DriverManager
> val url = "jdbc:h2:mem:testdb0"
> Class.forName("org.h2.Driver")
> val conn = DriverManager.getConnection(url)
> conn.prepareStatement("create schema test").executeUpdate()
> conn.prepareStatement("create table test.people (name TEXT(32) NOT NULL, theid INTEGER NOT NULL)").executeUpdate()
> conn.prepareStatement("insert into test.people values ('fred', 1)").executeUpdate()
> conn.commit()
> sql(s"""
> CREATE TEMPORARY TABLE foobar
> USING org.apache.spark.sql.jdbc
> OPTIONS (url '$url', dbtable 'TEST.PEOPLE')
> """)
> sql("select * from foobar where NAME='fred'").collect
> 15/03/19 06:34:38 ERROR Executor: Exception in task 0.0 in stage 1.0 (TID 1)
> org.h2.jdbc.JdbcSQLException: Column "FRED" not found; SQL statement:
> SELECT NAME,THEID FROM TEST.PEOPLE WHERE NAME = fred [42122-186]
> {code}
> Note that it is likely that other data types also have similar problem.



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