Interface ScalarReader

All Superinterfaces:
All Known Implementing Classes:
AbstractScalarReader, AbstractScalarReader.NullReader, BaseScalarReader, BaseScalarReader.BaseFixedWidthReader, BaseScalarReader.BaseVarWidthReader, BitColumnReader, ColumnAccessors.BigIntColumnReader, ColumnAccessors.DateColumnReader, ColumnAccessors.Decimal18ColumnReader, ColumnAccessors.Decimal28SparseColumnReader, ColumnAccessors.Decimal38SparseColumnReader, ColumnAccessors.Decimal9ColumnReader, ColumnAccessors.Float4ColumnReader, ColumnAccessors.Float8ColumnReader, ColumnAccessors.IntColumnReader, ColumnAccessors.IntervalColumnReader, ColumnAccessors.IntervalDayColumnReader, ColumnAccessors.IntervalYearColumnReader, ColumnAccessors.SmallIntColumnReader, ColumnAccessors.TimeColumnReader, ColumnAccessors.TimeStampColumnReader, ColumnAccessors.TinyIntColumnReader, ColumnAccessors.UInt1ColumnReader, ColumnAccessors.UInt2ColumnReader, ColumnAccessors.UInt4ColumnReader, ColumnAccessors.UInt8ColumnReader, ColumnAccessors.Var16CharColumnReader, ColumnAccessors.VarBinaryColumnReader, ColumnAccessors.VarCharColumnReader, ColumnAccessors.VarDecimalColumnReader, OffsetVectorReader

public interface ScalarReader extends ColumnReader
Defines a reader to obtain values from value vectors using a simple, uniform interface. Vector values are mapped to their "natural" representations: the representation closest to the actual vector value. For date and time values, this generally means a numeric value. Applications can then map this value to Java objects as desired. Decimal types all map to BigDecimal as that is the only way in Java to represent large decimal values.

In general, a column maps to just one value. However, derived classes may choose to provide type conversions if convenient. An exception is thrown if a call is made to a method that is not supported by the column type.

Values of scalars are provided directly, using the get method for the target type. Maps and arrays are structured types and require another level of reader abstraction to access each value in the structure.

Joda Period

Note that the interval columns here use the old Joda classes. As it turns out, JSR-310, the specification on which the Java 8 date/time classes are based, does not include the equivalent of the old Joda Interval class: a single object which can hold years, months, days, hours, minutes and seconds. Instead, JSR-310 has a Duration (for time) and a Period (for dates). Drill may have to create its own class to model the Drill INTERVAL type in JSR-310. Until then, we are stuck with the Joda classes.

See ScalarWriter

  • Method Details

    • valueType

      ValueType valueType()
      Describe the type of the value. This is a compression of the value vector type: it describes which method will return the vector value.
      the value type which indicates which get method is valid for the column
    • extendedType

      ValueType extendedType()
      The extended type of the value, describes the secondary type for DATE, TIME and TIMESTAMP for which the value type is int or long.
    • getInt

      int getInt()
    • getBoolean

      boolean getBoolean()
    • getLong

      long getLong()
    • getFloat

      float getFloat()
    • getDouble

      double getDouble()
    • getString

      String getString()
    • getBytes

      byte[] getBytes()
    • getDecimal

      BigDecimal getDecimal()
    • getPeriod

      org.joda.time.Period getPeriod()
    • getDate

      LocalDate getDate()
    • getTime

      LocalTime getTime()
    • getTimestamp

      Instant getTimestamp()
    • getValue

      Object getValue()
      Return the value of the object using the extended type.