spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yin Huai (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-11788) Using java.sql.Timestamp and java.sql.Date in where clauses on JDBC dataframes causes SQLServerException
Date Wed, 02 Dec 2015 00:05:11 GMT

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

Yin Huai updated SPARK-11788:
-----------------------------
    Fix Version/s: 1.5.3

> Using java.sql.Timestamp and java.sql.Date in where clauses on JDBC dataframes causes
SQLServerException
> --------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-11788
>                 URL: https://issues.apache.org/jira/browse/SPARK-11788
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.5.2
>            Reporter: Martin Tapp
>            Assignee: Huaxin Gao
>             Fix For: 1.5.3, 1.6.0
>
>
> I have a MSSQL table that has a timestamp column and am reading it using DataFrameReader.jdbc.
Adding a where clause which compares a timestamp range causes a SQLServerException.
> The problem is in https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala#L264
(compileValue) which should surround timestamps/dates with quotes (only does it for strings).
> Sample pseudo-code:
> val beg = new java.sql.Timestamp(...)
> val end = new java.sql.Timestamp(...)
> val filtered = jdbcdf.where($"TIMESTAMP_COLUMN" >= beg && $"TIMESTAMP_COLUMN"
< end)
> Generated SQL query: "TIMESTAMP_COLUMN >= 2015-01-01 00:00:00.0"
> Query should use quotes around timestamp: "TIMESTAMP_COLUMN >= '2015-01-01 00:00:00.0'"
> Fallback is to filter client-side which is extremely inefficient as the whole table needs
to be downloaded to each Spark executor.
> Thanks



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