Skip to content
Snippets Groups Projects
Commit 6f94d56a authored by Cheng Lian's avatar Cheng Lian
Browse files

[SPARK-10845] [SQL] Makes spark.sql.hive.version a SQLConfEntry

When refactoring SQL options from plain strings to the strongly typed `SQLConfEntry`, `spark.sql.hive.version` wasn't migrated, and doesn't show up in the result of `SET -v`, as `SET -v` only shows public `SQLConfEntry` instances. This affects compatibility with Simba ODBC driver.

This PR migrates this SQL option as a `SQLConfEntry` to fix this issue.

Author: Cheng Lian <lian@databricks.com>

Closes #8925 from liancheng/spark-10845/hive-version-conf.
parent 6fcee906
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,6 @@ object HiveThriftServer2 extends Logging {
@DeveloperApi
def startWithContext(sqlContext: HiveContext): Unit = {
val server = new HiveThriftServer2(sqlContext)
sqlContext.setConf("spark.sql.hive.version", HiveContext.hiveExecutionVersion)
server.init(sqlContext.hiveconf)
server.start()
listener = new HiveThriftServer2Listener(server, sqlContext.conf)
......
......@@ -21,6 +21,7 @@ import java.io.File
import java.net.URL
import java.sql.{Date, DriverManager, SQLException, Statement}
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
......@@ -431,6 +432,32 @@ class HiveThriftBinaryServerSuite extends HiveThriftJdbcTest {
}
)
}
test("Checks Hive version via SET -v") {
withJdbcStatement { statement =>
val resultSet = statement.executeQuery("SET -v")
val conf = mutable.Map.empty[String, String]
while (resultSet.next()) {
conf += resultSet.getString(1) -> resultSet.getString(2)
}
assert(conf.get("spark.sql.hive.version") === Some("1.2.1"))
}
}
test("Checks Hive version via SET") {
withJdbcStatement { statement =>
val resultSet = statement.executeQuery("SET")
val conf = mutable.Map.empty[String, String]
while (resultSet.next()) {
conf += resultSet.getString(1) -> resultSet.getString(2)
}
assert(conf.get("spark.sql.hive.version") === Some("1.2.1"))
}
}
}
class HiveThriftHttpServerSuite extends HiveThriftJdbcTest {
......
......@@ -610,6 +610,11 @@ private[hive] object HiveContext {
doc = "Version of the Hive metastore. Available options are " +
s"<code>0.12.0</code> through <code>$hiveExecutionVersion</code>.")
val HIVE_EXECUTION_VERSION = stringConf(
key = "spark.sql.hive.version",
defaultValue = Some(hiveExecutionVersion),
doc = "Version of Hive used internally by Spark SQL.")
val HIVE_METASTORE_JARS = stringConf("spark.sql.hive.metastore.jars",
defaultValue = Some("builtin"),
doc = s"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment