GitHub user viirya opened a pull request: https://github.com/apache/spark/pull/14282
[SPARK-16628][SQL] Don't convert Orc Metastore tables to datasource tables if metastore schema does not match schema stored in the files ## What changes were proposed in this pull request? We will convert Metastore Orc tables (represented by `MetastoreRelation`) to datasource tables (represented by `HadoopFsRelation`) if `spark.sql.hive.convertMetastoreOrc` is enabled for better performance. However, due to a Hive issue, an Orc table created by Hive does not store column name correctly in the Orc files. For these Orc tables, we can't do the conversion. This PR tries to compare the inferred schema of Orc files with Metastore schema. If they don't match, we skip the conversion and continue to use `MetastoreRelation`. As Parquet will have similar conversion, this PR does the same checking for it too. ## How was this patch tested? Jenkins tests. You can merge this pull request into a Git repository by running: $ git pull https://github.com/viirya/spark-1 detect-schema-when-convert-relation Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/14282.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 #14282 ---- commit 90444a22e319c9c4f78cf87f1b82a825d9675e22 Author: Liang-Chi Hsieh <sim...@tw.ibm.com> Date: 2016-07-20T08:30:05Z Don't convert Orc/Parquet Metastore tables to datasource tables if metastore schema does not match schema stored in the Orc/Parquet files. ---- --- 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