GitHub user wgtmac opened a pull request: https://github.com/apache/spark/pull/15155
[SPARK-17477][SQL] SparkSQL cannot handle schema evolution from Int -⦠## What changes were proposed in this pull request? Using SparkSession in Spark 2.0 to read a Hive table which is stored as parquet files and if there has been a schema evolution from int to long of a column, we will get java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.MutableLong cannot be cast to org.apache.spark.sql.catalyst.expressions.MutableInt. To be specific, if there are some old parquet files using int for the column while some new parquet files use long and the Hive metastore uses Long as its type, the aforementioned exception will be thrown. Because Hive and Presto deem this kind of schema evolution is valid, this PR allows writing a int value when its table schema is long in hive metastore. This is for non-vectorized parquet, will create a separate JIRA for vectorized parquet reader and come up with a fix later. ## How was this patch tested? Manual test to create parquet files with int type in the schema and create hive table using long as its type. Then perform spark.sql("select * from table") to query all data from this table. You can merge this pull request into a Git repository by running: $ git pull https://github.com/wgtmac/spark master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/15155.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 #15155 ---- commit 2f30184ed07c50506fd5c7ede05c989f2614e8c2 Author: Gang Wu <wgt...@uber.com> Date: 2016-09-19T22:27:40Z [SPARK-17477][SQL] SparkSQL cannot handle schema evolution from Int -> Long when parquet files have Int as its type while hive metastore has Long as its type ---- --- 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