Interface ChunkLinkFetcher

  • All Known Implementing Classes:
    SeaChunkLinkFetcher, ThriftChunkLinkFetcher

    public interface ChunkLinkFetcher
    Abstraction for fetching chunk links from either SEA or Thrift backend. Implementations handle the protocol-specific details of how links are retrieved.

    This interface enables a unified streaming approach for chunk downloads regardless of the underlying client type (SEA or Thrift).

    • Method Detail

      • fetchLinks

        ChunkLinkFetchResult fetchLinks​(long startChunkIndex,
                                        long startRowOffset)
                                 throws DatabricksSQLException
        Fetches the next batch of chunk links starting from the given position.

        The implementation may return one or more links in a single call. The returned ChunkLinkFetchResult indicates whether more chunks are available.

        SEA implementations use startChunkIndex while Thrift implementations use startRowOffset. Each implementation uses the parameter relevant to its protocol and ignores the other.

        Parameters:
        startChunkIndex - The chunk index to start fetching from (used by SEA)
        startRowOffset - The row offset to start fetching from (used by Thrift with FETCH_ABSOLUTE)
        Returns:
        ChunkLinkFetchResult containing the fetched links and continuation information
        Throws:
        DatabricksSQLException - if the fetch operation fails
      • refetchLink

        ExternalLink refetchLink​(long chunkIndex,
                                 long rowOffset)
                          throws DatabricksSQLException
        Refetches a specific chunk link that may have expired.

        This is used when a previously fetched link has expired before the chunk could be downloaded. Both SEA and Thrift clients support this via the getResultChunks API.

        SEA uses chunkIndex while Thrift uses rowOffset to identify the chunk to refetch.

        Parameters:
        chunkIndex - The specific chunk index to refetch (used by SEA)
        rowOffset - The row offset of the chunk to refetch (used by Thrift)
        Returns:
        The refreshed ExternalLink with a new expiration time
        Throws:
        DatabricksSQLException - if the refetch operation fails
      • close

        void close()
        Closes any resources held by the fetcher.