Skip to content

[SPARK-4908][SQL] Prevent multiple concurrent hive native commands #3834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
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