yaooqinn commented on a change in pull request #1317:
URL: https://github.com/apache/incubator-kyuubi/pull/1317#discussion_r742727440



##########
File path: 
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala
##########
@@ -88,12 +104,27 @@ private[v1] class SessionsResource extends 
ApiRequestContext {
   @DELETE
   @Path("{sessionHandle}")
   def closeSession(@PathParam("sessionHandle") sessionHandleStr: String): 
Response = {
-    val splitSessionHandle = sessionHandleStr.split("\\|")
-    val handleIdentifier = new HandleIdentifier(
-      UUID.fromString(splitSessionHandle(0)), 
UUID.fromString(splitSessionHandle(1)))
-    val protocolVersion = 
TProtocolVersion.findByValue(splitSessionHandle(2).toInt)
-    val sessionHandle = new SessionHandle(handleIdentifier, protocolVersion)
+    val sessionHandle = getSessionHandle(sessionHandleStr)
     backendService.closeSession(sessionHandle)
     Response.ok().build()
   }
+
+  def getSessionHandle(sessionHandleStr: String): SessionHandle = {
+    try {
+      val splitSessionHandle = sessionHandleStr.split("\\|")
+      val handleIdentifier = new HandleIdentifier(
+        UUID.fromString(splitSessionHandle(0)), 
UUID.fromString(splitSessionHandle(1)))
+      val protocolVersion = 
TProtocolVersion.findByValue(splitSessionHandle(2).toInt)

Review comment:
       @simon824 can you send a PR to remove TProtocolVersion for REST API. the 
client protocol is decided by client libraries that users use, not by users 
explicitly. So it's odd here to use both as a user-specified part of 
SessionHandle and also it is not related to the REST API at all. Also cc 
@yanghua 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to