Skip to content

Commit 4142bcb

Browse files
committed
Use Spark's classloader.
1 parent 09f7e45 commit 4142bcb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ package org.apache.spark.sql.hive
1919

2020
import scala.util.parsing.combinator.RegexParsers
2121

22-
import org.apache.hadoop.fs.Path
23-
import org.apache.hadoop.hive.conf.HiveConf
2422
import org.apache.hadoop.hive.metastore.api.{FieldSchema, StorageDescriptor, SerDeInfo}
2523
import org.apache.hadoop.hive.metastore.api.{Table => TTable, Partition => TPartition}
2624
import org.apache.hadoop.hive.ql.metadata.{Hive, Partition, Table}
@@ -39,6 +37,7 @@ import org.apache.spark.sql.catalyst.rules._
3937
import org.apache.spark.sql.catalyst.types._
4038
import org.apache.spark.sql.columnar.InMemoryRelation
4139
import org.apache.spark.sql.hive.execution.HiveTableScan
40+
import org.apache.spark.util.Utils
4241

4342
/* Implicit conversions */
4443
import scala.collection.JavaConversions._
@@ -288,7 +287,10 @@ private[hive] case class MetastoreRelation
288287
)
289288

290289
val tableDesc = new TableDesc(
291-
Class.forName(hiveQlTable.getSerializationLib).asInstanceOf[Class[Deserializer]],
290+
Class.forName(
291+
hiveQlTable.getSerializationLib,
292+
true,
293+
Utils.getContextOrSparkClassLoader).asInstanceOf[Class[Deserializer]],
292294
hiveQlTable.getInputFormatClass,
293295
// The class of table should be org.apache.hadoop.hive.ql.metadata.Table because
294296
// getOutputFormatClass will use HiveFileFormatUtils.getOutputFormatSubstitute to

0 commit comments

Comments
 (0)