Skip to content

Commit ea3c337

Browse files
committed
Added logs
1 parent 9c34acd commit ea3c337

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

src/databricks/sql/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,10 @@ def fetchall_arrow(self) -> "pyarrow.Table":
15151515
results = self.results.remaining_rows()
15161516
self._next_row_index += results.num_rows
15171517

1518+
print("Server side has more rows", self.has_more_rows)
1519+
15181520
while not self.has_been_closed_server_side and self.has_more_rows:
1521+
print(f"RESULT SIZE TOTAL {results.num_rows}")
15191522
self._fill_results_buffer()
15201523
partial_results = self.results.remaining_rows()
15211524
if isinstance(results, ColumnTable) and isinstance(

src/databricks/sql/cloudfetch/download_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def get_next_downloaded_file(
7878
next_row_offset, file.start_row_offset, file.row_count
7979
)
8080
)
81-
8281
return file
8382

8483
def _schedule_downloads(self):
8584
"""
8685
While download queue has a capacity, peek pending links and submit them to thread pool.
8786
"""
87+
print("Schedule_downloads")
8888
logger.debug("ResultFileDownloadManager: schedule downloads")
8989
while (len(self._download_tasks) < self._max_download_threads) and (
9090
len(self._pending_links) > 0

src/databricks/sql/cloudfetch/downloader.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def run(self) -> DownloadedFile:
9595
session.mount("https://", HTTPAdapter(max_retries=retryPolicy))
9696

9797
try:
98+
print_text = [
99+
100+
]
101+
start_time = time.time()
98102
# Get the file via HTTP request
99103
response = session.get(
100104
self.link.fileLink,
@@ -104,7 +108,8 @@ def run(self) -> DownloadedFile:
104108
# TODO: Pass cert from `self._ssl_options`
105109
)
106110
response.raise_for_status()
107-
111+
end_time = time.time()
112+
print_text.append(f"Downloaded file in {end_time - start_time} seconds")
108113
# Save (and decompress if needed) the downloaded file
109114
compressed_data = response.content
110115
decompressed_data = (
@@ -127,6 +132,13 @@ def run(self) -> DownloadedFile:
127132
)
128133
)
129134

135+
print_text.append(
136+
f"Downloaded file startRowOffset - {self.link.startRowOffset} - rowCount - {self.link.rowCount}"
137+
)
138+
139+
for text in print_text:
140+
print(text)
141+
130142
return DownloadedFile(
131143
decompressed_data,
132144
self.link.startRowOffset,

src/databricks/sql/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ def __init__(
235235
result_link.startRowOffset, result_link.rowCount
236236
)
237237
)
238+
print("Initial Setup Cloudfetch Queue")
239+
print(f"No of result links - {len(result_links)}")
238240
self.download_manager = ResultFileDownloadManager(
239241
links=result_links or [],
240242
max_download_threads=self.max_download_threads,
@@ -288,6 +290,9 @@ def remaining_rows(self) -> "pyarrow.Table":
288290
# Return empty pyarrow table to cause retry of fetch
289291
return self._create_empty_table()
290292
results = self.table.slice(0, 0)
293+
294+
print("remaining_rows call")
295+
print(f"self.table.num_rows - {self.table.num_rows}")
291296
while self.table:
292297
table_slice = self.table.slice(
293298
self.table_row_index, self.table.num_rows - self.table_row_index
@@ -296,6 +301,7 @@ def remaining_rows(self) -> "pyarrow.Table":
296301
self.table_row_index += table_slice.num_rows
297302
self.table = self._create_next_table()
298303
self.table_row_index = 0
304+
print(f"results.num_rows - {results.num_rows}")
299305
return results
300306

301307
def _create_next_table(self) -> Union["pyarrow.Table", None]:
@@ -334,7 +340,9 @@ def _create_next_table(self) -> Union["pyarrow.Table", None]:
334340
arrow_table.num_rows, self.start_row_index
335341
)
336342
)
337-
343+
344+
print("_create_next_table")
345+
print(f"arrow_table.num_rows - {arrow_table.num_rows}")
338346
return arrow_table
339347

340348
def _create_empty_table(self) -> "pyarrow.Table":

0 commit comments

Comments
 (0)