@@ -371,26 +371,11 @@ def _convert_to_thrift_link(self, link: "ExternalLink") -> TSparkArrowResultLink
371371 httpHeaders = link .http_headers or {},
372372 )
373373
374- def _create_next_table (self ) -> Union ["pyarrow.Table" , None ]:
375- """Create next table by retrieving the logical next downloaded file."""
376- logger .debug (
377- f"SeaCloudFetchQueue: Creating next table, current chunk link: { self ._current_chunk_link } "
378- )
379-
380- if not self ._current_chunk_link :
381- logger .debug ("SeaCloudFetchQueue: No current chunk link, returning None" )
382- return None
383-
384- if self .download_manager :
385- self .download_manager .add_link (
386- self ._convert_to_thrift_link (self ._current_chunk_link )
387- )
388-
389- row_offset = self ._current_chunk_link .row_offset
390- arrow_table = self ._create_table_at_offset (row_offset )
391-
374+ def _progress_chunk_link (self ):
375+ """Progress to the next chunk link."""
392376 next_chunk_index = self ._current_chunk_link .next_chunk_index
393377 self ._current_chunk_link = None
378+
394379 try :
395380 self ._current_chunk_link = self ._sea_client .get_chunk_link (
396381 self ._statement_id , next_chunk_index
@@ -402,6 +387,25 @@ def _create_next_table(self) -> Union["pyarrow.Table", None]:
402387 )
403388 )
404389
390+ def _create_next_table (self ) -> Union ["pyarrow.Table" , None ]:
391+ """Create next table by retrieving the logical next downloaded file."""
392+ if not self ._current_chunk_link :
393+ logger .debug ("SeaCloudFetchQueue: No current chunk link, returning None" )
394+ return None
395+
396+ logger .debug (
397+ f"SeaCloudFetchQueue: Trying to get downloaded file for chunk { self ._current_chunk_link .chunk_index } "
398+ )
399+
400+ if self .download_manager :
401+ thrift_link = self ._convert_to_thrift_link (self ._current_chunk_link )
402+ self .download_manager .add_link (thrift_link )
403+
404+ row_offset = self ._current_chunk_link .row_offset
405+ arrow_table = self ._create_table_at_offset (row_offset )
406+
407+ self ._progress_chunk_link ()
408+
405409 return arrow_table
406410
407411
0 commit comments