Skip to content

Commit 0cd17c8

Browse files
committed
minor telemetry changes
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent ddfae38 commit 0cd17c8

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

src/databricks/sql/backend/thrift_backend.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,6 @@ def get_execution_result(
895895
connection=cursor.connection,
896896
execute_response=execute_response,
897897
thrift_client=self,
898-
session_id_hex=self._session_id_hex,
899898
buffer_size_bytes=cursor.buffer_size_bytes,
900899
arraysize=cursor.arraysize,
901900
use_cloud_fetch=cursor.connection.use_cloud_fetch,
@@ -1040,7 +1039,6 @@ def execute_command(
10401039
max_download_threads=self.max_download_threads,
10411040
ssl_options=self._ssl_options,
10421041
has_more_rows=has_more_rows,
1043-
session_id_hex=self._session_id_hex,
10441042
)
10451043

10461044
def get_catalogs(
@@ -1079,7 +1077,6 @@ def get_catalogs(
10791077
max_download_threads=self.max_download_threads,
10801078
ssl_options=self._ssl_options,
10811079
has_more_rows=has_more_rows,
1082-
session_id_hex=self._session_id_hex,
10831080
)
10841081

10851082
def get_schemas(
@@ -1124,7 +1121,6 @@ def get_schemas(
11241121
max_download_threads=self.max_download_threads,
11251122
ssl_options=self._ssl_options,
11261123
has_more_rows=has_more_rows,
1127-
session_id_hex=self._session_id_hex,
11281124
)
11291125

11301126
def get_tables(
@@ -1173,7 +1169,6 @@ def get_tables(
11731169
max_download_threads=self.max_download_threads,
11741170
ssl_options=self._ssl_options,
11751171
has_more_rows=has_more_rows,
1176-
session_id_hex=self._session_id_hex,
11771172
)
11781173

11791174
def get_columns(
@@ -1222,7 +1217,6 @@ def get_columns(
12221217
max_download_threads=self.max_download_threads,
12231218
ssl_options=self._ssl_options,
12241219
has_more_rows=has_more_rows,
1225-
session_id_hex=self._session_id_hex,
12261220
)
12271221

12281222
def _handle_execute_response(self, resp, cursor):

src/databricks/sql/result_set.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def __init__(
197197
connection: Connection,
198198
execute_response: ExecuteResponse,
199199
thrift_client: ThriftDatabricksClient,
200-
session_id_hex: Optional[str],
201200
buffer_size_bytes: int = 104857600,
202201
arraysize: int = 10000,
203202
use_cloud_fetch: bool = True,
@@ -221,7 +220,7 @@ def __init__(
221220
:param ssl_options: SSL options for cloud fetch
222221
:param has_more_rows: Whether there are more rows to fetch
223222
"""
224-
self.num_downloaded_chunks = 0
223+
self.num_chunks = 0
225224

226225
# Initialize ThriftResultSet-specific attributes
227226
self._use_cloud_fetch = use_cloud_fetch
@@ -241,12 +240,12 @@ def __init__(
241240
lz4_compressed=execute_response.lz4_compressed,
242241
description=execute_response.description,
243242
ssl_options=ssl_options,
244-
session_id_hex=session_id_hex,
243+
session_id_hex=connection.get_session_id_hex(),
245244
statement_id=execute_response.command_id.to_hex_guid(),
246-
chunk_id=self.num_downloaded_chunks,
245+
chunk_id=self.num_chunks,
247246
)
248247
if t_row_set.resultLinks:
249-
self.num_downloaded_chunks += len(t_row_set.resultLinks)
248+
self.num_chunks += len(t_row_set.resultLinks)
250249

251250
# Call parent constructor with common attributes
252251
super().__init__(
@@ -279,11 +278,11 @@ def _fill_results_buffer(self):
279278
arrow_schema_bytes=self._arrow_schema_bytes,
280279
description=self.description,
281280
use_cloud_fetch=self._use_cloud_fetch,
282-
chunk_id=self.num_downloaded_chunks,
281+
chunk_id=self.num_chunks,
283282
)
284283
self.results = results
285284
self.has_more_rows = has_more_rows
286-
self.num_downloaded_chunks += result_links_count
285+
self.num_chunks += result_links_count
287286

288287
def _convert_columnar_table(self, table):
289288
column_names = [c[0] for c in self.description]

tests/unit/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
127127
connection=connection,
128128
execute_response=mock_execute_response,
129129
thrift_client=mock_backend,
130-
session_id_hex=Mock(),
131130
)
132131

133132
# Mock execute_command to return our real result set
@@ -187,7 +186,6 @@ def test_closing_result_set_with_closed_connection_soft_closes_commands(self):
187186
connection=mock_connection,
188187
execute_response=Mock(),
189188
thrift_client=mock_backend,
190-
session_id_hex=Mock(),
191189
)
192190
result_set.results = mock_results
193191

@@ -217,7 +215,6 @@ def test_closing_result_set_hard_closes_commands(self):
217215
mock_connection,
218216
mock_results_response,
219217
mock_thrift_backend,
220-
session_id_hex=Mock(),
221218
)
222219
result_set.results = mock_results
223220

@@ -266,7 +263,7 @@ def test_negative_fetch_throws_exception(self):
266263
mock_backend.fetch_results.return_value = (Mock(), False, 0)
267264

268265
result_set = ThriftResultSet(
269-
Mock(), Mock(), mock_backend, session_id_hex=Mock()
266+
Mock(), Mock(), mock_backend
270267
)
271268

272269
with self.assertRaises(ValueError) as e:

tests/unit/test_fetches.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def make_dummy_result_set_from_initial_results(initial_results):
6363
),
6464
thrift_client=mock_thrift_backend,
6565
t_row_set=None,
66-
session_id_hex=Mock(),
6766
)
6867
return rs
6968

@@ -108,7 +107,6 @@ def fetch_results(
108107
is_staging_operation=False,
109108
),
110109
thrift_client=mock_thrift_backend,
111-
session_id_hex=Mock(),
112110
)
113111
return rs
114112

0 commit comments

Comments
 (0)