Skip to main content
Package com.gpudb

Class RecordRetriever.Lookup

java.lang.Object
com.gpudb.RecordRetriever.Lookup
All Implemented Interfaces:
Enclosing class:

public final class RecordRetriever.Lookup extends Object implements Iterable<T>
The records one lookup returns, read a page at a time in a single pass.

On a replicated table every page is taken from one worker rank, drawn at random when the first page is read: each rank holds the whole table in an order of its own, so a page from another rank could repeat or skip records. A lookup made with RecordRetriever.getByKey(List, String, long) and an offset has no such identity — one call cannot know whether the next is its next page — so those send every call with one expression to one rank per retriever; a lookup made here is spread over the ranks lookup by lookup. Should the routing be rebuilt during the pass — the rank leaving the cluster, a fail-over, a change of shard mapping — the pass fails rather than go on from another rank.

size() is the number of records the lookup matches, known once its first page has been read; asking for it reads that page.

  • Method Details

    • size

      public long size() throws GPUdbException
      Returns:
      how many records the lookup matches in all; reads the first page if none has been read
      Throws:
      GPUdbException - if the page cannot be read
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>