Class ThriftChunkLinkFetcher

  • All Implemented Interfaces:
    ChunkLinkFetcher

    public class ThriftChunkLinkFetcher
    extends Object
    implements ChunkLinkFetcher
    ChunkLinkFetcher implementation for the Thrift client.

    Thrift provides chunk links via the getResultChunks API, which returns links with nextChunkIndex to indicate continuation. When nextChunkIndex is null, it indicates no more chunks.

    • Method Detail

      • fetchLinks

        public ChunkLinkFetchResult fetchLinks​(long startChunkIndex,
                                               long startRowOffset)
                                        throws SQLException
        Description copied from interface: ChunkLinkFetcher
        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.

        Specified by:
        fetchLinks in interface ChunkLinkFetcher
        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:
        SQLException - if the fetch operation fails
      • refetchLink

        public ExternalLink refetchLink​(long chunkIndex,
                                        long rowOffset)
                                 throws SQLException
        Description copied from interface: ChunkLinkFetcher
        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.

        Specified by:
        refetchLink in interface ChunkLinkFetcher
        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:
        SQLException - if the refetch operation fails