Class AbstractScalarReader

java.lang.Object
org.apache.drill.exec.vector.accessor.reader.AbstractScalarReader
All Implemented Interfaces:
ColumnReader, ReaderEvents, ScalarReader
Direct Known Subclasses:
AbstractScalarReader.NullReader, BaseScalarReader

public abstract class AbstractScalarReader extends Object implements ScalarReader, ReaderEvents
  • Field Details

  • Constructor Details

    • AbstractScalarReader

      public AbstractScalarReader()
  • Method Details

    • nullReader

      public static AbstractScalarReader.ScalarObjectReader nullReader(ColumnMetadata schema)
    • bindIndex

      public void bindIndex(ColumnReaderIndex rowIndex)
      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
      Returns:
      type of reader
    • extendedType

      public ValueType extendedType()
      Description copied from interface: ScalarReader
      The extended type of the value, describes the secondary type for DATE, TIME and TIMESTAMP for which the value type is int or long.
      Specified by:
      extendedType in interface ScalarReader
    • nullStateReader

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

      public void reposition()
      Specified by:
      reposition 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
      Returns:
      true if this value is null; false otherwise
    • conversionError

      protected UnsupportedConversionError conversionError(String javaType)
    • getBoolean

      public boolean getBoolean()
      Specified by:
      getBoolean in interface ScalarReader
    • getInt

      public int getInt()
      Specified by:
      getInt in interface ScalarReader
    • getLong

      public long getLong()
      Specified by:
      getLong in interface ScalarReader
    • getFloat

      public float getFloat()
      Specified by:
      getFloat in interface ScalarReader
    • getDouble

      public double getDouble()
      Specified by:
      getDouble in interface ScalarReader
    • getString

      public String getString()
      Specified by:
      getString in interface ScalarReader
    • getBytes

      public byte[] getBytes()
      Specified by:
      getBytes in interface ScalarReader
    • getDecimal

      public BigDecimal getDecimal()
      Specified by:
      getDecimal in interface ScalarReader
    • getPeriod

      public org.joda.time.Period getPeriod()
      Specified by:
      getPeriod in interface ScalarReader
    • getDate

      public LocalDate getDate()
      Specified by:
      getDate in interface ScalarReader
    • getTime

      public LocalTime getTime()
      Specified by:
      getTime in interface ScalarReader
    • getTimestamp

      public Instant getTimestamp()
      Specified by:
      getTimestamp in interface ScalarReader
    • 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
      Returns:
      the value as a Java object
    • getValue

      public Object getValue()
      Description copied from interface: ScalarReader
      Return the value of the object using the extended type.
      Specified by:
      getValue in interface ScalarReader
    • 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
      Returns:
      string representation of the object