GitHub user HyukjinKwon opened a pull request: https://github.com/apache/spark/pull/17589
[SPARK-16544][SQL] Support for conversion from numeric compatible schema for Parquet readers ## What changes were proposed in this pull request? This PR proposes schema compatibility for Parquet for normal Parquet reader. It does not fully solve the issue for vectorized reader one. 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 import org.apache.spark.sql.types._ spark.conf.set("spark.sql.parquet.enableVectorizedReader", false.toString) val path = "/tmp/abcd" 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 Parquet supports this schema compatibility for numeric types. ## 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/17589.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 #17589 ---- commit 1d4d40c0e6a7318cf6a2f2f783c3c110b63cd724 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