File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed
src/databricks/sql/backend Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -18,21 +18,27 @@ class CommandState(Enum):
1818
1919 @classmethod
2020 def from_thrift_state (cls , state : ttypes .TOperationState ) -> "CommandState" :
21- match state :
22- case ttypes .TOperationState .INITIALIZED_STATE | ttypes .TOperationState .PENDING_STATE :
23- return cls .PENDING
24- case ttypes .TOperationState .RUNNING_STATE :
25- return cls .RUNNING
26- case ttypes .TOperationState .FINISHED_STATE :
27- return cls .SUCCEEDED
28- case ttypes .TOperationState .ERROR_STATE | ttypes .TOperationState .TIMEDOUT_STATE | ttypes .TOperationState .UKNOWN_STATE :
29- return cls .FAILED
30- case ttypes .TOperationState .CLOSED_STATE :
31- return cls .CLOSED
32- case ttypes .TOperationState .CANCELLED_STATE :
33- return cls .CANCELLED
34- case _:
35- raise ValueError (f"Unknown command state: { state } " )
21+ if state in (
22+ ttypes .TOperationState .INITIALIZED_STATE ,
23+ ttypes .TOperationState .PENDING_STATE ,
24+ ):
25+ return cls .PENDING
26+ elif state == ttypes .TOperationState .RUNNING_STATE :
27+ return cls .RUNNING
28+ elif state == ttypes .TOperationState .FINISHED_STATE :
29+ return cls .SUCCEEDED
30+ elif state in (
31+ ttypes .TOperationState .ERROR_STATE ,
32+ ttypes .TOperationState .TIMEDOUT_STATE ,
33+ ttypes .TOperationState .UKNOWN_STATE ,
34+ ):
35+ return cls .FAILED
36+ elif state == ttypes .TOperationState .CLOSED_STATE :
37+ return cls .CLOSED
38+ elif state == ttypes .TOperationState .CANCELLED_STATE :
39+ return cls .CANCELLED
40+ else :
41+ raise ValueError (f"Unknown command state: { state } " )
3642
3743
3844def guid_to_hex_id (guid : bytes ) -> str :
You can’t perform that action at this time.
0 commit comments