Skip to content
Snippets Groups Projects
Commit c874723f authored by Yin Huai's avatar Yin Huai Committed by Michael Armbrust
Browse files

[SPARK-2877] [SQL] MetastoreRelation should use SparkClassLoader when creating the tableDesc

JIRA: https://issues.apache.org/jira/browse/SPARK-2877

Author: Yin Huai <huai@cse.ohio-state.edu>

Closes #1806 from yhuai/SPARK-2877 and squashes the following commits:

4142bcb [Yin Huai] Use Spark's classloader.
parent 0489cee6
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,6 @@ package org.apache.spark.sql.hive
import scala.util.parsing.combinator.RegexParsers
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.metastore.api.{FieldSchema, StorageDescriptor, SerDeInfo}
import org.apache.hadoop.hive.metastore.api.{Table => TTable, Partition => TPartition}
import org.apache.hadoop.hive.ql.metadata.{Hive, Partition, Table}
......@@ -39,6 +37,7 @@ import org.apache.spark.sql.catalyst.rules._
import org.apache.spark.sql.catalyst.types._
import org.apache.spark.sql.columnar.InMemoryRelation
import org.apache.spark.sql.hive.execution.HiveTableScan
import org.apache.spark.util.Utils
/* Implicit conversions */
import scala.collection.JavaConversions._
......@@ -288,7 +287,10 @@ private[hive] case class MetastoreRelation
)
val tableDesc = new TableDesc(
Class.forName(hiveQlTable.getSerializationLib).asInstanceOf[Class[Deserializer]],
Class.forName(
hiveQlTable.getSerializationLib,
true,
Utils.getContextOrSparkClassLoader).asInstanceOf[Class[Deserializer]],
hiveQlTable.getInputFormatClass,
// The class of table should be org.apache.hadoop.hive.ql.metadata.Table because
// getOutputFormatClass will use HiveFileFormatUtils.getOutputFormatSubstitute to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment