Skip to content

Commit bf6d41c

Browse files
ensure command_id is not None
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 726abe7 commit bf6d41c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/databricks/sql/backend/thrift_backend.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ def _results_message_to_execute_response(self, resp, operation_state):
796796
arrow_queue_opt = None
797797

798798
command_id = CommandId.from_thrift_handle(resp.operationHandle)
799+
if command_id is None:
800+
raise ValueError(f"Invalid Thrift handle: {resp.operationHandle}")
799801

800802
return ExecuteResponse(
801803
arrow_queue=arrow_queue_opt,
@@ -1156,6 +1158,8 @@ def get_columns(
11561158

11571159
def _handle_execute_response(self, resp, cursor):
11581160
command_id = CommandId.from_thrift_handle(resp.operationHandle)
1161+
if command_id is None:
1162+
raise ValueError(f"Invalid Thrift handle: {resp.operationHandle}")
11591163

11601164
cursor.active_command_id = command_id
11611165
self._check_direct_results_for_error(resp.directResults)
@@ -1169,6 +1173,9 @@ def _handle_execute_response(self, resp, cursor):
11691173

11701174
def _handle_execute_response_async(self, resp, cursor):
11711175
command_id = CommandId.from_thrift_handle(resp.operationHandle)
1176+
if command_id is None:
1177+
raise ValueError(f"Invalid Thrift handle: {resp.operationHandle}")
1178+
11721179
cursor.active_command_id = command_id
11731180
self._check_direct_results_for_error(resp.directResults)
11741181

0 commit comments

Comments
 (0)