Class UnnestColumnValueSelectorCursor

java.lang.Object
org.apache.druid.segment.UnnestColumnValueSelectorCursor
All Implemented Interfaces:
Cursor

public class UnnestColumnValueSelectorCursor extends Object implements Cursor
The cursor to help unnest MVDs without dictionary encoding and ARRAY type selectors.

Consider a segment has 2 rows ['a', 'b', 'c'] ['d', 'e']

The baseCursor points to the row ['a', 'b', 'c'] while the unnestCursor with each call of advance() moves over individual elements.

unnestCursor.advance() -> 'a' unnestCursor.advance() -> 'b' unnestCursor.advance() -> 'c' unnestCursor.advance() -> 'd' (advances base cursor first) unnestCursor.advance() -> 'e'

The index reference points to the index of each row that the unnest cursor is accessing through currentVal The index ranges from 0 to the size of the list in each row which is held in the unnestListForCurrentRow

The needInitialization flag sets up the initial values of unnestListForCurrentRow at the beginning of the segment

  • Constructor Details

  • Method Details

    • getColumnSelectorFactory

      public ColumnSelectorFactory getColumnSelectorFactory()
      Description copied from interface: Cursor
      Get a ColumnSelectorFactory whose selectors will be backed by the row values at the current position of the cursor
      Specified by:
      getColumnSelectorFactory in interface Cursor
    • advance

      public void advance()
      Description copied from interface: Cursor
      Advance the cursor to the next position, checking if thread has been interrupted after advancing and possibly throwing QueryInterruptedException if so. Callers should check Cursor.isDone() or Cursor.isDoneOrInterrupted() before getting the next value from a selector.
      Specified by:
      advance in interface Cursor
    • advanceUninterruptibly

      public void advanceUninterruptibly()
      Description copied from interface: Cursor
      Advance to the cursor to the next position. Callers should check Cursor.isDone() or Cursor.isDoneOrInterrupted() before getting the next value from a selector. However, underlying implementation may still check for thread interruption if advancing the cursor is a long-running operation.
      Specified by:
      advanceUninterruptibly in interface Cursor
    • isDone

      public boolean isDone()
      Description copied from interface: Cursor
      Check if the current cursor position is valid, returning false if there are values to read from selectors created by Cursor.getColumnSelectorFactory(). If true, any such selectors will no longer produce values.
      Specified by:
      isDone in interface Cursor
    • isDoneOrInterrupted

      public boolean isDoneOrInterrupted()
      Description copied from interface: Cursor
      Check if the current cursor position is valid, or if the thread has been interrupted.
      Specified by:
      isDoneOrInterrupted in interface Cursor
      See Also:
    • reset

      public void reset()
      Description copied from interface: Cursor
      Reset to start of cursor. Most cursor implementations are backed by immutable data, but there is generically no guarantee that advancing through a cursor again will read exactly the same data or even number of rows, since the underlying data might be mutable in some cases.
      Specified by:
      reset in interface Cursor