TimestampColumnVector (Hive Storage API 2.1.1-pre-orc API)
Date: 2016-10-19

org.apache.hadoop.hive.ql.exec.vector

## Class TimestampColumnVector

- java.lang.Object
- - org.apache.hadoop.hive.ql.exec.vector.ColumnVector
  - - org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector

-     public class TimestampColumnVector
      extends ColumnVector

  This class represents a nullable timestamp column vector capable of handing a wide range of timestamp values. We store the 2 (value) fields of a Timestamp class in primitive arrays. We do this to avoid an array of Java Timestamp objects which would have poor storage and memory access characteristics. Generally, the caller will fill in a scratch timestamp object with values from a row, work using the scratch timestamp, and then perhaps update the column vector row with a result.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.hadoop.hive.ql.exec.vector.ColumnVector

      `ColumnVector.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int[]` | `nanos`
    `long[]` | `time`

    - ### Fields inherited from class org.apache.hadoop.hive.ql.exec.vector.ColumnVector

      `isNull, isRepeating, noNulls`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimestampColumnVector()` Use this constructor by default.
    `TimestampColumnVector(int len)` Don't use this except for testing purposes.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Timestamp` | `asScratchTimestamp(int elementNum)` Return the scratch Timestamp object set from a row.
    `int` | `compareTo(int elementNum, Timestamp timestamp)` Compare row to Timestamp.
    `int` | `compareTo(int elementNum1, TimestampColumnVector timestampColVector2, int elementNum2)` Compare a row to another TimestampColumnVector's row.
    `int` | `compareTo(TimestampColumnVector timestampColVector1, int elementNum1, int elementNum2)` Compare another TimestampColumnVector's row to a row.
    `int` | `compareTo(Timestamp timestamp, int elementNum)` Compare Timestamp to row.
    `void` | `copySelected(boolean selectedInUse, int[] sel, int size, TimestampColumnVector output)`
    `void` | `ensureSize(int size, boolean preserveData)` Ensure the ColumnVector can hold at least size values.
    `void` | `fill(Timestamp timestamp)` Fill all the vector entries with a timestamp.
    `void` | `flatten(boolean selectedInUse, int[] sel, int size)`
    `double` | `getDouble(int elementNum)` Return a double representation of a Timestamp.
    `static double` | `getDouble(Timestamp timestamp)` Return a double representation of a Timestamp.
    `int` | `getLength()` Return the number of rows.
    `int` | `getNanos(int elementNum)` Return a row's Timestamp.getNanos() value.
    `Timestamp` | `getScratchTimestamp()` Return the scratch timestamp (contents undefined).
    `org.apache.hadoop.io.Writable` | `getScratchWritable()` Return a convenience writable object stored by this column vector.
    `long` | `getTime(int elementNum)` Return a row's Timestamp.getTime() value.
    `long` | `getTimestampAsLong(int elementNum)` Return a long representation of a Timestamp.
    `static long` | `getTimestampAsLong(Timestamp timestamp)` Return a long representation of a Timestamp.
    `void` | `set(int elementNum, Timestamp timestamp)` Set a row from a timestamp.
    `void` | `setElement(int outElementNum, int inputElementNum, ColumnVector inputVector)` Set the element in this column vector from the given input vector.
    `void` | `setFromScratchTimestamp(int elementNum)` Set a row from the current value in the scratch timestamp.
    `void` | `setNullValue(int elementNum)` Set row to standard null value(s).
    `void` | `setScratchWritable(org.apache.hadoop.io.Writable scratchWritable)` Set the convenience writable object stored by this column vector
    `void` | `stringifyValue(StringBuilder buffer, int row)` Print the value for this column into the given string builder.
    `void` | `timestampUpdate(Timestamp timestamp, int elementNum)` Set a Timestamp object from a row of the column.

    - ### Methods inherited from class org.apache.hadoop.hive.ql.exec.vector.ColumnVector

      `flattenNoNulls, flattenPush, flattenRepeatingNulls, init, reset, setRepeating, unFlatten`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### time

          public long[] time

    - #### nanos

          public int[] nanos

  - ### Constructor Detail

    - #### TimestampColumnVector

          public TimestampColumnVector()

      Use this constructor by default. All column vectors should normally be the default size.

    - #### TimestampColumnVector

          public TimestampColumnVector(int len)

      Don't use this except for testing purposes.
      Parameters:
        `len` - the number of rows

  - ### Method Detail

    - #### getLength

          public int getLength()

      Return the number of rows.
      Returns:

    - #### getTime

          public long getTime(int elementNum)

      Return a row's Timestamp.getTime() value. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `elementNum` -
      Returns:

    - #### getNanos

          public int getNanos(int elementNum)

      Return a row's Timestamp.getNanos() value. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `elementNum` -
      Returns:

    - #### timestampUpdate

          public void timestampUpdate(Timestamp timestamp,
                                      int elementNum)

      Set a Timestamp object from a row of the column. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `timestamp` -
        `elementNum` -

    - #### asScratchTimestamp

          public Timestamp asScratchTimestamp(int elementNum)

      Return the scratch Timestamp object set from a row. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `elementNum` -
      Returns:

    - #### getScratchTimestamp

          public Timestamp getScratchTimestamp()

      Return the scratch timestamp (contents undefined).
      Returns:

    - #### getTimestampAsLong

          public long getTimestampAsLong(int elementNum)

      Return a long representation of a Timestamp.
      Parameters:
        `elementNum` -
      Returns:

    - #### getTimestampAsLong

          public static long getTimestampAsLong(Timestamp timestamp)

      Return a long representation of a Timestamp.
      Parameters:
        `timestamp` -
      Returns:

    - #### getDouble

          public double getDouble(int elementNum)

      Return a double representation of a Timestamp.
      Parameters:
        `elementNum` -
      Returns:

    - #### getDouble

          public static double getDouble(Timestamp timestamp)

      Return a double representation of a Timestamp.
      Parameters:
        `timestamp` -
      Returns:

    - #### compareTo

          public int compareTo(int elementNum,
                               Timestamp timestamp)

      Compare row to Timestamp. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `elementNum` -
        `timestamp` -
      Returns:
        -1, 0, 1 standard compareTo values.

    - #### compareTo

          public int compareTo(Timestamp timestamp,
                               int elementNum)

      Compare Timestamp to row. We assume the entry has already been NULL checked and isRepeated adjusted.
      Parameters:
        `timestamp` -
        `elementNum` -
      Returns:
        -1, 0, 1 standard compareTo values.

    - #### compareTo

          public int compareTo(int elementNum1,
                               TimestampColumnVector timestampColVector2,
                               int elementNum2)

      Compare a row to another TimestampColumnVector's row.
      Parameters:
        `elementNum1` -
        `timestampColVector2` -
        `elementNum2` -
      Returns:

    - #### compareTo

          public int compareTo(TimestampColumnVector timestampColVector1,
                               int elementNum1,
                               int elementNum2)

      Compare another TimestampColumnVector's row to a row.
      Parameters:
        `timestampColVector1` -
        `elementNum1` -
        `elementNum2` -
      Returns:

    - #### setElement

          public void setElement(int outElementNum,
                                 int inputElementNum,
                                 ColumnVector inputVector)

      Description copied from class: `ColumnVector`
      Set the element in this column vector from the given input vector. This method can assume that the output does not have isRepeating set.
      Specified by:
        `setElement` in class `ColumnVector`

    - #### flatten

          public void flatten(boolean selectedInUse,
                              int[] sel,
                              int size)

      Specified by:
        `flatten` in class `ColumnVector`

    - #### set

          public void set(int elementNum,
                          Timestamp timestamp)

      Set a row from a timestamp. We assume the entry has already been isRepeated adjusted.
      Parameters:
        `elementNum` -
        `timestamp` -

    - #### setFromScratchTimestamp

          public void setFromScratchTimestamp(int elementNum)

      Set a row from the current value in the scratch timestamp.
      Parameters:
        `elementNum` -

    - #### setNullValue

          public void setNullValue(int elementNum)

      Set row to standard null value(s). We assume the entry has already been isRepeated adjusted.
      Parameters:
        `elementNum` -

    - #### copySelected

          public void copySelected(boolean selectedInUse,
                                   int[] sel,
                                   int size,
                                   TimestampColumnVector output)

    - #### fill

          public void fill(Timestamp timestamp)

      Fill all the vector entries with a timestamp.
      Parameters:
        `timestamp` -

    - #### getScratchWritable

          public org.apache.hadoop.io.Writable getScratchWritable()

      Return a convenience writable object stored by this column vector. Supports keeping a TimestampWritable object without having to import that definition...
      Returns:

    - #### setScratchWritable

          public void setScratchWritable(org.apache.hadoop.io.Writable scratchWritable)

      Set the convenience writable object stored by this column vector
      Parameters:
        `scratchWritable` -

    - #### stringifyValue

          public void stringifyValue(StringBuilder buffer,
                                     int row)

      Description copied from class: `ColumnVector`
      Print the value for this column into the given string builder.
      Specified by:
        `stringifyValue` in class `ColumnVector`
      Parameters:
        `buffer` - the buffer to print into
        `row` - the id of the row to print

    - #### ensureSize

          public void ensureSize(int size,
                                 boolean preserveData)

      Description copied from class: `ColumnVector`
      Ensure the ColumnVector can hold at least size values. This method is deliberately *not* recursive because the complex types can easily have more (or less) children than the upper levels.
      Overrides:
        `ensureSize` in class `ColumnVector`
      Parameters:
        `size` - the new minimum size
        `preserveData` - should the old data be preserved?

Copyright © 2016 The Apache Software Foundation. All rights reserved.