Interface ColumnWriterIndex

All Known Implementing Classes:
AbstractArrayWriter.ArrayElementWriterIndex, NullableScalarWriter.ChildIndex, ScalarArrayWriter.ScalarElementWriterIndex

public interface ColumnWriterIndex
A Drill record batch consists of a variety of vectors, including maps and lists. Each vector is written independently. A reader may skip some values in each row if no values appear for those columns.

This index provides a single view of the "current row" or "current array index" across a set of vectors. Each writer consults this index to determine:

  • The position to which to write a value.
  • Whether the write position is beyond the "last write" position, which would require filling in any "missing" values.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Increment the index for an array.
    If this index represents a repeat level, return the index of the next higher repeat level.
    void
    Decrement the index for an array.
    void
    When handling overflow, the index must be reset so that the current row starts at the start of the vector.
    int
    Index of the first entry for the current row
    int
    Current row or array index.
  • Method Details

    • rowStartIndex

      int rowStartIndex()
      Index of the first entry for the current row
      Returns:
      index of the first entry for the current row
    • vectorIndex

      int vectorIndex()
      Current row or array index.
      Returns:
      row or array index
    • nextElement

      void nextElement()
      Increment the index for an array. For arrays, writing (or saving) one value automatically moves to the next value. Ignored for non-element indexes.
    • prevElement

      void prevElement()
      Decrement the index for an array. Used exclusively for appending bytes to a VarChar, Var16Char or VarBytes column. Assumed to be followed by another call to nextElement().
    • rollover

      void rollover()
      When handling overflow, the index must be reset so that the current row starts at the start of the vector. Relative offsets must be preserved. (That is, if the current write position for an array is four greater than the start, then that offset must now be reset to four from the start of the vector.)
    • outerIndex

      ColumnWriterIndex outerIndex()
      If this index represents a repeat level, return the index of the next higher repeat level.
      Returns:
      the outer repeat level index, if any