You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by somideshmukh <gi...@git.apache.org> on 2015/11/04 12:12:13 UTC

[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

GitHub user somideshmukh opened a pull request:

    https://github.com/apache/spark/pull/9465

    [SPARK-10946]JDBC - Use Statement.executeUpdate instead of PreparedStatement.executeUpdate for DDLs

    Changed against PreparedStatement to CreateStatement

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/somideshmukh/spark SomilBranch1.5.1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9465.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #9465
    
----
commit be53d3006865182e68c2c69eb432188c7009c4fe
Author: somideshmukh <so...@us.ibm.com>
Date:   2015-11-04T11:08:39Z

    [SPARK-10946][SQL]JDBC - Use Statement.executeUpdate instead of PreparedStatement.executeUpdate for DDLs

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-153694144
  
    **[Test build #1977 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1977/consoleFull)** for PR 9465 at commit [`be53d30`](https://github.com/apache/spark/commit/be53d3006865182e68c2c69eb432188c7009c4fe).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-153693769
  
    @somideshmukh yep there you go. That's correct.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-153720290
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by somideshmukh <gi...@git.apache.org>.
Github user somideshmukh closed the pull request at:

    https://github.com/apache/spark/pull/9465


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9465#discussion_r44146876
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala ---
    @@ -276,7 +276,7 @@ final class DataFrameWriter private[sql](df: DataFrame) {
           if (!tableExists) {
             val schema = JdbcUtils.schemaString(df, url)
             val sql = s"CREATE TABLE $table ($schema)"
    -        conn.prepareStatement(sql).executeUpdate()
    +        conn.createStatement.executeUpdate(sql)
    --- End diff --
    
    Hm, it occurs to me that there are several places where `prepareStatement` or `createStatement` are called, but the `Statement` is not explicitly `close()`ed. They're the two here that you are changing, plus a few others.
    
    `JDBCRDD`:
    ```
          val rs = conn.prepareStatement(s"SELECT * FROM $table WHERE 1=0").executeQuery()
    ```
    `JdbcUtils.tableExists`
    ```
        Try(conn.prepareStatement(dialect.getTableExistsQuery(table)).executeQuery()).isSuccess
    ```
    
    I'm OK to commit this as-is since it's a fix for DDL, but you'd be welcome to also correct handling of the `Statement` here, and then while at it, correct the other 2 occurrences in the code base nearby.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-153689230
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-153718920
  
    **[Test build #1977 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1977/consoleFull)** for PR 9465 at commit [`be53d30`](https://github.com/apache/spark/commit/be53d3006865182e68c2c69eb432188c7009c4fe).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-10946]JDBC - Use Statement.executeUpdat...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/9465#issuecomment-156155485
  
    @somideshmukh this PR is now corrupted with unrelated commits. Can you revert those and push. Also are you interested in looking at the other changes I mentioned here? Either way I'd like to resolve this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org