yaooqinn commented on a change in pull request #1317:
URL: https://github.com/apache/incubator-kyuubi/pull/1317#discussion_r742775090
##########
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:
For a session handle instance, TProtocolVersion is not necessary, as you
can see the overridden equal/hashCode funcs. It's mainly used to decide the
compatibility for kyuubi server and its thrift client, e.g. the result layout.
I am not very familiar with REST API, does the `v1` also indicate the
compatibility thing between rest clients and servers?
--
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]