Class ArrayReaderImpl

All Implemented Interfaces:
ArrayReader, ColumnReader, ReaderEvents
Direct Known Subclasses:

public class ArrayReaderImpl extends Object implements ArrayReader, ReaderEvents
Reader for an array-valued column. This reader provides access to specific array members via an array index. This class implements all arrays. The behavior for specific array types (scalar, map, lists, etc.) is provided through composition.
  • Field Details

  • Constructor Details

  • Method Details

    • buildScalar

      public static ArrayReaderImpl.ArrayObjectReader buildScalar(ColumnMetadata schema, VectorAccessor arrayAccessor, BaseScalarReader elementReader)
      Build a scalar array for a Repeated type. Such arrays are not nullable.
      arrayAccessor - vector accessor for the repeated vector that holds the scalar values
      elementReader - scalar reader used to decode each scalar value
      object reader which wraps the scalar array reader
    • buildTuple

      public static AbstractObjectReader buildTuple(ColumnMetadata schema, VectorAccessor arrayAccessor, AbstractObjectReader elementReader)
      Build a repeated map reader.
      arrayAccessor - vector accessor for the repeated map vector
      elementReader - tuple reader that provides access to each tuple in the array
      object reader that wraps the map array reader
    • buildList

      public static AbstractObjectReader buildList(ColumnMetadata schema, VectorAccessor listAccessor, AbstractObjectReader elementReader)
      Build a list reader. Lists entries can be null. The reader can be a simple scalar, a map, a union, or another list.
      listAccessor -
      elementReader -
    • buildRepeatedList

      public static AbstractObjectReader buildRepeatedList(ColumnMetadata schema, VectorAccessor listAccessor, AbstractObjectReader elementReader)
      Build a 2+D array reader. The backing vector must be a repeated list. The element reader must itself be a repeated list, or a repeated of some other type.
      schema -
      listAccessor -
      elementReader -
    • bindIndex

      public void bindIndex(ColumnReaderIndex index)
      Specified by:
      bindIndex in interface ReaderEvents
    • bindNullState

      public void bindNullState(NullStateReader nullStateReader)
      Specified by:
      bindNullState in interface ReaderEvents
    • type

      public ObjectType type()
      Description copied from interface: ColumnReader
      The type of this reader.
      Specified by:
      type in interface ColumnReader
      type of reader
    • schema

      public ColumnMetadata schema()
      Specified by:
      schema in interface ColumnReader
    • nullStateReader

      public NullStateReader nullStateReader()
      Specified by:
      nullStateReader in interface ReaderEvents
    • isNull

      public boolean isNull()
      Description copied from interface: ColumnReader
      Determine if this value is null.
      • Nullable scalar: determine if the value is null.
      • Non-nullable scalar: always returns false.
      • Arrays: always returns false</tt.>
      • Lists: determine if the list for the current row is null. In a list, an array entry can be null, empty, or can contain items. In repeated types, the array itself is never null. If the array is null, then it implicitly has no entries.
      • Map or Repeated Map: Always returns false.
      • Map inside a union, or in a list that contains a union, the tuple itself can be null.
      • Union: Determine if the current value is null. Null values have no type and no associated reader.
      Specified by:
      isNull in interface ColumnReader
      true if this value is null; false otherwise
    • reposition

      public void reposition()
      Specified by:
      reposition in interface ReaderEvents
    • next

      public boolean next()
      Description copied from interface: ArrayReader
      Move forward one position.
      Specified by:
      next in interface ArrayReader
      true if another position is available, false if the end of the array is reached
    • elementIndex

      public ColumnReaderIndex elementIndex()
    • size

      public int size()
      Description copied from interface: ArrayReader
      Number of elements in the array.
      Specified by:
      size in interface ArrayReader
      the number of elements
    • setPosn

      public void setPosn(int posn)
      Description copied from interface: ArrayReader
      Set the array reader to read a given array entry. Not used for scalars, only for maps and arrays when using the non-indexed methods ArrayReader.entry(), ArrayReader.tuple() and ArrayReader.array().
      Specified by:
      setPosn in interface ArrayReader
    • rewind

      public void rewind()
      Specified by:
      rewind in interface ArrayReader
    • bindBuffer

      public void bindBuffer()
      Specified by:
      bindBuffer in interface ReaderEvents
    • entry

      public ObjectReader entry()
      Description copied from interface: ArrayReader
      Return the generic object reader for the array element. This version does not position the reader, the client must call ArrayReader.setPosn(int) to set the position. This form allows up-front setup of the readers when convenient for the caller.
      Specified by:
      entry in interface ArrayReader
    • entryType

      public ObjectType entryType()
      Description copied from interface: ArrayReader
      The object type of the list entry. All entries have the same type.
      Specified by:
      entryType in interface ArrayReader
      the object type of each entry
    • scalar

      public ScalarReader scalar()
      Specified by:
      scalar in interface ArrayReader
    • tuple

      public TupleReader tuple()
      Specified by:
      tuple in interface ArrayReader
    • array

      public ArrayReader array()
      Specified by:
      array in interface ArrayReader
    • variant

      public VariantReader variant()
      Specified by:
      variant in interface ArrayReader
    • getObject

      public Object getObject()
      Description copied from interface: ColumnReader
      Return the value of the underlying data as a Java object. Primarily for testing
      • Array: Return the entire array as an List of objects. Note, even if the array is scalar, the elements are still returned as a list.
      Specified by:
      getObject in interface ColumnReader
      the value as a Java object
    • getAsString

      public String getAsString()
      Description copied from interface: ColumnReader
      Return the entire object as a string. Primarily for debugging.
      Specified by:
      getAsString in interface ColumnReader
      string representation of the object