Skip to content

Commit c1a9e90

Browse files
stronger typing
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 7ce8745 commit c1a9e90

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/databricks/sql/backend/sea/queue.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ def _convert_to_thrift_link(self, link: "ExternalLink") -> TSparkArrowResultLink
172172
httpHeaders=link.http_headers or {},
173173
)
174174

175-
def _get_chunk_link(self, chunk_index: int) -> Optional["ExternalLink"]:
175+
def _get_chunk_link(self, chunk_index: int) -> "ExternalLink":
176176
"""Progress to the next chunk link."""
177177
if chunk_index >= self._total_chunk_count:
178-
return None
178+
raise ValueError(
179+
f"Chunk index {chunk_index} is out of bounds, total chunks: {self._total_chunk_count}"
180+
)
179181

180182
try:
181-
return self._sea_client.get_chunk_link(
182-
self._statement_id, chunk_index
183-
)
183+
return self._sea_client.get_chunk_link(self._statement_id, chunk_index)
184184
except Exception as e:
185185
raise ServerOperationError(
186186
f"Error fetching link for chunk {chunk_index}: {e}",
@@ -205,12 +205,6 @@ def _create_table_from_link(
205205

206206
def _create_next_table(self) -> Union["pyarrow.Table", None]:
207207
"""Create next table by retrieving the logical next downloaded file."""
208-
209-
print(self._current_chunk_index)
210208
self._current_chunk_index += 1
211209
next_chunk_link = self._get_chunk_link(self._current_chunk_index)
212-
213-
if not next_chunk_link:
214-
logger.debug("SeaCloudFetchQueue: No current chunk link, returning")
215-
return None
216210
return self._create_table_from_link(next_chunk_link)

0 commit comments

Comments
 (0)