Skip to content

Commit 88371ea

Browse files
type issues
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 7f82580 commit 88371ea

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/databricks/sql/result_set.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
self.status: CommandState = status
7474
self.has_been_closed_server_side: bool = has_been_closed_server_side
7575
self.is_direct_results: bool = is_direct_results
76-
self.results: Optional[ResultSetQueue] = None # Children will set this
76+
self.results: Optional[ResultSetQueue] = None
7777
self._is_staging_operation: bool = is_staging_operation
7878
self.lz4_compressed: bool = lz4_compressed
7979
self._arrow_schema_bytes: Optional[bytes] = arrow_schema_bytes
@@ -166,7 +166,8 @@ def close(self) -> None:
166166
been closed on the server for some other reason, issue a request to the server to close it.
167167
"""
168168
try:
169-
self.results.close()
169+
if self.results:
170+
self.results.close()
170171
if (
171172
self.status != CommandState.CLOSED
172173
and not self.has_been_closed_server_side

tests/unit/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_closing_result_set_hard_closes_commands(self):
219219
mock_results_response = Mock()
220220
mock_results_response.has_been_closed_server_side = False
221221
mock_connection = Mock()
222-
mock_thrift_backend = Mock()
222+
mock_thrift_backend = Mock(spec=ThriftDatabricksClient)
223223
mock_results = Mock()
224224
# Setup session mock on the mock_connection
225225
mock_session = Mock()

0 commit comments

Comments
 (0)