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



##########
File path: 
kyuubi-common/src/main/scala/org/apache/kyuubi/service/ThriftBinaryFrontendService.scala
##########
@@ -500,6 +501,27 @@ abstract class ThriftBinaryFrontendService(name: String)
     resp
   }
 
+  /**
+   * Get Operation handle from TOperationHandle.
+   * The actual operation type might be a Kyuubi defined operation type that 
uses hive thrift
+   * RPC with UNKNOWN OperationType, lookup it by HandleIdentifier.
+   * @param tOperationHandle hive thrift OperationHandle.
+   * @throws UnsupportedOperationException if the actual operation type is 
neither hive thrift
+   *                                       operation nor kyuubi defined 
operation
+   * @return actual operation handle, might be a kyuubi thrift operation
+   */
+  private def getOperationHandle(tOperationHandle: TOperationHandle): 
OperationHandle = {
+    try {
+      OperationHandle(tOperationHandle)
+    } catch {
+      case ue: UnsupportedOperationException =>
+        val handleIdentifier = 
HandleIdentifier(tOperationHandle.getOperationId)
+        be.sessionManager.operationManager.findOperation(handleIdentifier)
+          .filter(opHandle => 
OperationType.isKyuubiDefinedOperationType(opHandle.typ))
+          .getOrElse(throw ue)
+    }
+  }

Review comment:
       If we can map it to `UNKNOWN`, or change `OperationHandle.equals` that 
when typ=UNKNOWN then only compare the `id`, we can make it more simple?.




-- 
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