Class Offset

java.lang.Object
org.apache.druid.segment.data.Offset
All Implemented Interfaces:
Cloneable, HotLoopCallee, ReadableOffset
Direct Known Subclasses:
BitmapOffset, FilteredOffset, QueryableIndexCursorHolder.TimestampCheckingOffset, SimpleSettableOffset

@SubclassesMustBePublic public abstract class Offset extends Object implements ReadableOffset, Cloneable
The "mutable" version of a ReadableOffset. Introduces "increment()" and "withinBounds()" methods, which are very similar to "next()" and "hasNext()" on the Iterator interface except increment() does not return a value. This class is not thread-safe, all it's methods, including reset() and clone(), must be called from a single thread. Annotated with SubclassesMustBePublic because Offset occurrences are replaced with a subclass in Historical1SimpleDoubleAggPooledTopNScannerPrototype and HistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopNScannerPrototype during specialization, and specialized version of those prototypes must be able to any subclass of Offset. This interface is the core "pointer" interface that is used to create ColumnValueSelectors over historical segments. It's counterpart for incremental index is IncrementalIndexRowHolder.
  • Constructor Details

    • Offset

      public Offset()
  • Method Details

    • increment

      @CalledFromHotLoop public abstract void increment()
      Move to next offset
    • withinBounds

      @CalledFromHotLoop public abstract boolean withinBounds()
      Check if current offset position is within the valid range
    • reset

      public abstract void reset()
      Resets the Offset to the position it was created or cloned with.
    • getBaseReadableOffset

      public abstract ReadableOffset getBaseReadableOffset()
      Returns the same offset ("this") or a readable "view" of this offset, which always returns the same value from ReadableOffset.getOffset(), as this offset. This method is useful for "unwrapping" such offsets as FilteredOffset and reduce reference indirection, when only ReadableOffset API is needed.
    • clone

      public Offset clone()
      Overrides:
      clone in class Object