@@ -506,7 +506,7 @@ def _check_protocol_version(self, t_open_session_resp):
506506 "SPARK_CLI_SERVICE_PROTOCOL_V2, "
507507 "instead got: {}" .format (protocol_version )
508508 )
509-
509+
510510 def _check_initial_namespace (self , catalog , schema , response ):
511511 if not (catalog or schema ):
512512 return
@@ -569,7 +569,7 @@ def open_session(self, session_configuration, catalog, schema):
569569 response = self .make_request (self ._client .OpenSession , open_session_req )
570570 self ._check_initial_namespace (catalog , schema , response )
571571 self ._check_protocol_version (response )
572- return response . sessionHandle
572+ return self . get_session_handle_from_resp ( response )
573573 except :
574574 self ._transport .close ()
575575 raise
@@ -1014,6 +1014,13 @@ def cancel_command(self, active_op_handle):
10141014 req = ttypes .TCancelOperationReq (active_op_handle )
10151015 self .make_request (self ._client .CancelOperation , req )
10161016
1017+ @staticmethod
1018+ def get_session_handle_from_resp (t_open_session_resp ):
1019+ sessionHandle = t_open_session_resp .sessionHandle
1020+ if sessionHandle .serverProtocolVersion == None :
1021+ sessionHandle .serverProtocolVersion = t_open_session_resp .serverProtocolVersion
1022+ return sessionHandle
1023+
10171024 @staticmethod
10181025 def handle_to_id (session_handle ):
10191026 return session_handle .sessionId .guid
0 commit comments