[
https://issues.apache.org/jira/browse/SPARK-10664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14803331#comment-14803331
]
Suresh Thalamati commented on SPARK-10664:
------------------------------------------
Table exists case should be fixed as part of SPARK-9078 fix. This one is fix
is recently in the latest code line.
> JDBC DataFrameWriter does not save data to Oracle 11 Database
> -------------------------------------------------------------
>
> Key: SPARK-10664
> URL: https://issues.apache.org/jira/browse/SPARK-10664
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.5.0
> Reporter: Dmitriy Atorin
> Priority: Critical
>
> The issue is that Oracle 11 and less does not support LIMIT function.
> The issue is here:
> 1 . Go in org.apache.spark.sql.execution.datasources.jdbc
> 2. object JdbcUtils
> 3.
> def tableExists(conn: Connection, table: String): Boolean = {
> // Somewhat hacky, but there isn't a good way to identify whether a table
> exists for all
> // SQL database systems, considering "table" could also include the
> database name.
> Try(conn.prepareStatement(s"SELECT 1 FROM $table LIMIT
> 1").executeQuery().next()).isSuccess
> }
> I think it is better to write in this way
> s"SELECT count(*) FROM $table WHERE 1=0"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]