Skip to content

Commit b99107f

Browse files
committed
Added test case for ADD JAR command
1 parent 095b2c7 commit b99107f

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
package org.apache.spark.sql.hive.execution
1919

20+
import java.io.File
21+
2022
import scala.util.Try
2123

22-
import org.apache.spark.sql.{SchemaRDD, Row}
24+
import org.apache.spark.SparkException
2325
import org.apache.spark.sql.hive._
2426
import org.apache.spark.sql.hive.test.TestHive
2527
import org.apache.spark.sql.hive.test.TestHive._
@@ -313,7 +315,7 @@ class HiveQuerySuite extends HiveComparisonTest {
313315
"SELECT srcalias.KEY, SRCALIAS.value FROM sRc SrCAlias WHERE SrCAlias.kEy < 15")
314316

315317
test("case sensitivity: registered table") {
316-
val testData: SchemaRDD =
318+
val testData =
317319
TestHive.sparkContext.parallelize(
318320
TestData(1, "str1") ::
319321
TestData(2, "str2") :: Nil)
@@ -467,7 +469,7 @@ class HiveQuerySuite extends HiveComparisonTest {
467469
}
468470

469471
// Describe a registered temporary table.
470-
val testData: SchemaRDD =
472+
val testData =
471473
TestHive.sparkContext.parallelize(
472474
TestData(1, "str1") ::
473475
TestData(1, "str2") :: Nil)
@@ -495,6 +497,23 @@ class HiveQuerySuite extends HiveComparisonTest {
495497
}
496498
}
497499

500+
test("ADD JAR command") {
501+
val testJar = TestHive.getHiveFile("data/files/TestSerDe.jar").getCanonicalPath
502+
sql("CREATE TABLE alter1(a INT, b INT)")
503+
intercept[Exception] {
504+
sql(
505+
"""ALTER TABLE alter1 SET SERDE 'org.apache.hadoop.hive.serde2.TestSerDe'
506+
|WITH serdeproperties('s1'='9')
507+
""".stripMargin)
508+
}
509+
sql(s"ADD JAR $testJar")
510+
sql(
511+
"""ALTER TABLE alter1 SET SERDE 'org.apache.hadoop.hive.serde2.TestSerDe'
512+
|WITH serdeproperties('s1'='9')
513+
""".stripMargin)
514+
sql("DROP TABLE alter1")
515+
}
516+
498517
test("parse HQL set commands") {
499518
// Adapted from its SQL counterpart.
500519
val testKey = "spark.sql.key.usedfortestonly"

0 commit comments

Comments
 (0)