aboutsummaryrefslogtreecommitdiff
path: root/sql/hive-thriftserver/src/main/scala
diff options
context:
space:
mode:
Diffstat (limited to 'sql/hive-thriftserver/src/main/scala')
-rw-r--r--sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala
index 665a44e51a..8de223f444 100644
--- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala
+++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala
@@ -54,13 +54,15 @@ private[hive] object SparkSQLEnv extends Logging {
"spark.kryo.referenceTracking",
maybeKryoReferenceTracking.getOrElse("false"))
- sparkContext = new SparkContext(sparkConf)
- sqlContext = SparkSession.withHiveSupport(sparkContext).wrapped
- val sessionState = sqlContext.sessionState.asInstanceOf[HiveSessionState]
+ val sparkSession = SparkSession.builder.config(sparkConf).enableHiveSupport().getOrCreate()
+ sparkContext = sparkSession.sparkContext
+ sqlContext = sparkSession.wrapped
+
+ val sessionState = sparkSession.sessionState.asInstanceOf[HiveSessionState]
sessionState.metadataHive.setOut(new PrintStream(System.out, true, "UTF-8"))
sessionState.metadataHive.setInfo(new PrintStream(System.err, true, "UTF-8"))
sessionState.metadataHive.setError(new PrintStream(System.err, true, "UTF-8"))
- sqlContext.setConf("spark.sql.hive.version", HiveUtils.hiveExecutionVersion)
+ sparkSession.conf.set("spark.sql.hive.version", HiveUtils.hiveExecutionVersion)
}
}