spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Lian (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-6408) JDBCRDD fails on where clause with string literal
Date Thu, 19 Mar 2015 13:14:38 GMT

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

Cheng Lian updated SPARK-6408:
------------------------------
            Priority: Blocker  (was: Critical)
    Target Version/s: 1.3.1

> 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
>            Priority: Blocker
>
> 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


Mime
View raw message