@@ -25,6 +25,7 @@ import java.io.{BufferedReader, InputStreamReader}
2525import java .net .ServerSocket
2626import java .sql .{Connection , DriverManager , Statement }
2727
28+ import org .apache .hadoop .hive .conf .HiveConf .ConfVars
2829import org .scalatest .{BeforeAndAfterAll , FunSuite }
2930
3031import org .apache .spark .Logging
@@ -63,16 +64,18 @@ class HiveThriftServer2Suite extends FunSuite with BeforeAndAfterAll with TestUt
6364 // Forking a new process to start the Hive Thrift server. The reason to do this is it is
6465 // hard to clean up Hive resources entirely, so we just start a new process and kill
6566 // that process for cleanup.
66- val defaultArgs = Seq (
67- " ../../sbin/start-thriftserver.sh" ,
68- " --master local" ,
69- " --hiveconf" ,
70- " hive.root.logger=INFO,console" ,
71- " --hiveconf" ,
72- s " javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName= $METASTORE_PATH;create=true " ,
73- " --hiveconf" ,
74- s " hive.metastore.warehouse.dir= $WAREHOUSE_PATH" )
75- val pb = new ProcessBuilder (defaultArgs ++ args)
67+ val jdbcUrl = s " jdbc:derby:;databaseName= $METASTORE_PATH;create=true "
68+ val command =
69+ s """ ../../sbin/start-thriftserver.sh
70+ | --master local
71+ | --hiveconf hive.root.logger=INFO,console
72+ | --hiveconf ${ConfVars .METASTORECONNECTURLKEY }=" $jdbcUrl"
73+ | --hiveconf ${ConfVars .METASTOREWAREHOUSE }= $METASTORE_PATH
74+ | --hiveconf ${ConfVars .HIVE_SERVER2_THRIFT_BIND_HOST }= $HOST
75+ | --hiveconf ${ConfVars .HIVE_SERVER2_THRIFT_PORT }= $PORT
76+ """ .stripMargin.split(" \\ s+" )
77+
78+ val pb = new ProcessBuilder (command ++ args : _* )
7679 val environment = pb.environment()
7780 environment.put(" HIVE_SERVER2_THRIFT_PORT" , PORT .toString)
7881 environment.put(" HIVE_SERVER2_THRIFT_BIND_HOST" , HOST )
0 commit comments