Class DirectConverter

java.lang.Object
org.apache.drill.exec.physical.impl.scan.convert.ColumnConverter
org.apache.drill.exec.physical.impl.scan.convert.DirectConverter
All Implemented Interfaces:
ValueWriter
Direct Known Subclasses:
AbstractConvertFromString, ConvertBooleanToString, ConvertDateToString, ConvertDecimalToString, ConvertDoubleToDecimal, ConvertDoubleToString, ConvertFloatToDecimal, ConvertIntervalToString, ConvertIntToDecimal, ConvertIntToString, ConvertLongToDecimal, ConvertLongToString, ConvertTimeStampToString, ConvertTimeToString

public class DirectConverter extends ColumnConverter implements ValueWriter
Base class for Java type-based conversion. Use this base class if your reader works with Java types, but you need to convert from one Java type to another (such as decoding a byte array, converting a string to a number, etc.)

Instances of this class can be freely mixed with "plain" ScalarWriter instances to avoid unnecessary calls when there is a direct mapping from reader Java type to Drill type. You only need insert converters for those columns where some conversion step is needed.

  • Constructor Details

    • DirectConverter

      public DirectConverter(ScalarWriter colWriter)
  • Method Details

    • setNull

      public void setNull()
      Description copied from interface: ValueWriter
      Set the current value to null. throws IllegalStateException if called on a non-nullable value.
      Specified by:
      setNull in interface ValueWriter
    • setBoolean

      public void setBoolean(boolean value)
      Specified by:
      setBoolean in interface ValueWriter
    • setInt

      public void setInt(int value)
      Specified by:
      setInt in interface ValueWriter
    • setLong

      public void setLong(long value)
      Specified by:
      setLong in interface ValueWriter
    • setFloat

      public void setFloat(float value)
      Specified by:
      setFloat in interface ValueWriter
    • setDouble

      public void setDouble(double value)
      Specified by:
      setDouble in interface ValueWriter
    • setString

      public void setString(String value)
      Specified by:
      setString in interface ValueWriter
    • setBytes

      public void setBytes(byte[] value, int len)
      Specified by:
      setBytes in interface ValueWriter
    • appendBytes

      public void appendBytes(byte[] value, int len)
      Specified by:
      appendBytes in interface ValueWriter
    • setDecimal

      public void setDecimal(BigDecimal value)
      Specified by:
      setDecimal in interface ValueWriter
    • setPeriod

      public void setPeriod(org.joda.time.Period value)
      Specified by:
      setPeriod in interface ValueWriter
    • setDate

      public void setDate(LocalDate value)
      Specified by:
      setDate in interface ValueWriter
    • setTime

      public void setTime(LocalTime value)
      Specified by:
      setTime in interface ValueWriter
    • setTimestamp

      public void setTimestamp(Instant value)
      Specified by:
      setTimestamp in interface ValueWriter
    • setValue

      public void setValue(Object value)
      Description copied from interface: ValueWriter
      Write value to a vector as a Java object of the "native" type for the column. This form is available only on scalar writers. The object must be of the form for the primary write method above.

      Primarily to be used when the code already knows the object type.

      Specified by:
      setValue in interface ValueWriter
      Parameters:
      value - a value that matches the primary setter above, or null to set the column to null
      See Also: