GitHub user gatorsmile opened a pull request:

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

    [SPARK-16054] [SQL] Verification of DataFrameReader API Usage

    #### What changes were proposed in this pull request?
    Below are **potential user errors** when using DataFrameReader APIs
    
    - Specify format when reading tables from catalog.
    ```scala
    spark.read.format("parquet").table(tableName)
    ```
    - Specify schema when reading tables from catalog
    ```scala
    val schema = StructType(StructField("c1", IntegerType) :: Nil)
    spark.read.schema(schema).table(tableName)
    ```
    - Specify options when reading tables from catalog
    ```scala
    spark.read.options(Map("header" -> "true", "mode" -> 
"dropmalformed")).table(tableName)
    ```
    - Specify the format more than once
    ```scala
    val format = "parquet"
    spark.read.format(format).json(path.getCanonicalPath)
    ```
    - Specify schema more than once.
    ```scala
    spark.read.schema(schema1).schema(schema2).json(path.getCanonicalPath)
    ```
    This PR detects these user errors and issues the exception.
    
    #### How was this patch tested?
    Test cases are added to `DataFrameReaderWriterSuite`

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

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

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

    https://github.com/apache/spark/pull/13770.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 #13770
    
----
commit bce14a161e0248ef0a5e2170f0d1d0c930f3b5dd
Author: gatorsmile <[email protected]>
Date:   2016-06-19T07:10:30Z

    fix

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to