Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,20 @@ class CliSuite extends FunSuite with BeforeAndAfter with Logging {
-> "hive_test"
)
}

test("Single command with --jars") {
val jarFile =
Thread.currentThread().getContextClassLoader
.getResource("data/files/hive-hcatalog-core-0.13.1.jar")
runCliWithin(1.minute,
Seq(
"--jars",
s"$jarFile",
"-e",
"""CREATE TABLE t1(a string, b string) ROW FORMAT
| SERDE 'org.apache.hive.hcatalog.data.JsonSerDe';""".stripMargin))(
""
-> "OK"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HadoopTableReader(
makeRDDForTable(
hiveTable,
Class.forName(
relation.tableDesc.getSerdeClassName, true, Utils.getSparkClassLoader)
relation.tableDesc.getSerdeClassName, true, Utils.getContextOrSparkClassLoader)
.asInstanceOf[Class[Deserializer]],
filterOpt = None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ private[hive] class IsolatedClientLoader(
name.startsWith("com.google") ||
name.startsWith("java.lang.") ||
name.startsWith("java.net") ||
name.startsWith("org.apache.hadoop.conf") ||
name.startsWith("org.apache.hadoop.hive.serde") || // TODO keep adding?
sharedPrefixes.exists(name.startsWith)

/** True if `name` refers to a spark class that must see specific version of Hive. */
Expand All @@ -150,7 +152,9 @@ private[hive] class IsolatedClientLoader(
defineClass(name, bytes, 0, bytes.length)
} else if (!isSharedClass(name)) {
logDebug(s"hive class: $name - ${getResource(classToPath(name))}")
super.loadClass(name, resolve)
try super.loadClass(name, resolve) catch {
case _: ClassNotFoundException => baseClassLoader.loadClass(name)
}
} else {
logDebug(s"shared class: $name")
baseClassLoader.loadClass(name)
Expand Down