Skip to content

Commit

Permalink
prevent multiple concurrent hive native commands
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Dec 30, 2014
1 parent 040d6f2 commit bf25300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
* Execute the command using Hive and return the results as a sequence. Each element
* in the sequence is one row.
*/
protected def runHive(cmd: String, maxRows: Int = 1000): Seq[String] = {
protected def runHive(cmd: String, maxRows: Int = 1000): Seq[String] = synchronized {
try {
val cmd_trimmed: String = cmd.trim()
val tokens: Array[String] = cmd_trimmed.split("\\s+")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class HiveQuerySuite extends HiveComparisonTest with BeforeAndAfter {
Locale.setDefault(originalLocale)
}

test("SPARK-4908: concurent hive native commands") {
(1 to 100).par.map { _ =>
sql("USE default")
sql("SHOW TABLES")
}
}

createQueryTest("constant object inspector for generic udf",
"""SELECT named_struct(
lower("AA"), "10",
Expand Down

0 comments on commit bf25300

Please sign in to comment.