GitHub user HyukjinKwon opened a pull request:

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

    [SPARK-16544][SQL][WIP] Support for conversion from compatible schema for 
Parquet data source when data types are not matched

    ## What changes were proposed in this pull request?
    
    This PR adds schema compatibility for Parquet.
    
    Currently if user-given schema is different with the Parquet schema, it 
throws an exception even when the user-given schema is compatible with Parquet 
schema.
    
    For example, executing the codes below:
    
    ```scala
    val path = "/tmp/test.parquet"
    val data = (1 to 4).map(Tuple1(_))
    spark.createDataFrame(data).toDF("a").write.parquet(path)
    val schema = StructType(StructField("a", LongType, true) :: Nil)
    spark.read.schema(schema).parquet(path).show()
    ```
    
    throws an exception as below:
    
    ```
    org.apache.parquet.io.ParquetDecodingException: Can not read value at 1 in 
block 0 
    ...
    ```
    
    This PR lets Parqet supports this schema compatibility.
    
    - [x] Schema compatibility for `NumericType` except `DecimalType`. 
    - [ ] Schema compatibility for other `AtomicType`.
    - [ ] Schema compatibility for vectorized reader.
    
    ## How was this patch tested?
    
    Unit tests in `ParquetIOSuite`.

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

    $ git pull https://github.com/HyukjinKwon/spark SPARK-16544

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

    https://github.com/apache/spark/pull/14215.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 #14215
    
----
commit b45f2eae8417d9fdf1ecb8de7dd0a43a3d4c0fa8
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2016-07-15T03:37:45Z

    Support for conversion from compatible schema for Parquet data source when 
data types are not matched

----


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