GitHub user gatorsmile opened a pull request:

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

    [SPARK-16402] [SQL] JDBC Source: Implement save API

    #### What changes were proposed in this pull request?
    Before this PR, we are unable to call the `save` API of `DataFrameWriter` 
when the source is JDBC. For example, 
    ```Scala
    df.write
      .format("jdbc")
      .option("url", url1)
      .option("dbtable", "TEST.TRUNCATETEST")
      .option("user", "testUser")
      .option("password", "testPass")
      .save() 
    ```
    The error message users will get is like
    ```
    org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider does 
not allow create table as select.
    java.lang.RuntimeException: 
org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider does not 
allow create table as select.
    ```
    
    At the same time, users can do it for the other data sources, like `parquet`
    
    This PR is to implement `createRelation` of `CreatableRelationProvider`. 
After the changes, we can use `save` API of `DataFrameWriter`. 
    
    #### How was this patch tested?
    Added test cases

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

    $ git pull https://github.com/gatorsmile/spark jdbcSave

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

    https://github.com/apache/spark/pull/14077.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 #14077
    
----
commit 732e592ccaab9b8105fab8dbd57c66eff067a4f4
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-07-06T19:36:30Z

    jdbc.

commit 1b4db1ad59ec59275f6d5ac9f8479b16072e9bc8
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-07-06T21:17:15Z

    fix

commit 50c9de85fd76a87caa4eb432c74cb9717d48f9e6
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-07-06T21:18:48Z

    revert

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to