Skip to content

Commit 459efbd

Browse files
committed
[SQL]Delete some dupliate code in HiveThriftServer2
1 parent 3980ebd commit 459efbd

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,20 @@ private[hive] class HiveThriftServer2(hiveContext: HiveContext)
9898
setSuperField(this, "cliService", sparkSqlCliService)
9999
addService(sparkSqlCliService)
100100

101-
if (isHTTPTransportMode(hiveConf)) {
102-
val thriftCliService = new ThriftHttpCLIService(sparkSqlCliService)
103-
setSuperField(this, "thriftCLIService", thriftCliService)
104-
addService(thriftCliService)
101+
val thriftCliService = if (isHTTPTransportMode(hiveConf)){
102+
new ThriftHttpCLIService(sparkSqlCliService)
105103
} else {
106-
val thriftCliService = new ThriftBinaryCLIService(sparkSqlCliService)
107-
setSuperField(this, "thriftCLIService", thriftCliService)
108-
addService(thriftCliService)
104+
new ThriftBinaryCLIService(sparkSqlCliService)
109105
}
110106

107+
setSuperField(this, "thriftCLIService", thriftCliService)
108+
addService(thriftCliService)
111109
initCompositeService(hiveConf)
112110
}
113111

114112
private def isHTTPTransportMode(hiveConf: HiveConf): Boolean = {
115113
val transportMode: String = hiveConf.getVar(ConfVars.HIVE_SERVER2_TRANSPORT_MODE)
116-
transportMode.equalsIgnoreCase("http")
114+
transportMode.toLowerCase().equals("http")
117115
}
118116

119117
}

0 commit comments

Comments
 (0)