GitHub user wgtmac opened a pull request:

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

    [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

    ## 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 reader only.
    
    
    ## 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 SPARK-17477

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

    https://github.com/apache/spark/pull/15264.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 #15264
    
----
commit aae648a5a1f1fdb0a78b316d7a497ee51bbac73f
Author: Gang Wu <wgt...@uber.com>
Date:   2016-09-27T18:07:54Z

    [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

Reply via email to