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

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

## Class ColumnVector

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

- Direct Known Subclasses:
    BytesColumnVector, DecimalColumnVector, DoubleColumnVector, IntervalDayTimeColumnVector, LongColumnVector, MultiValuedColumnVector, StructColumnVector, TimestampColumnVector, UnionColumnVector

      public abstract class ColumnVector
      extends Object

  ColumnVector contains the shared structure for the sub-types, including NULL information, and whether this vector repeats, i.e. has all values the same, so only the first one is set. This is used to accelerate query performance by handling a whole vector in O(1) time when applicable. The fields are public by design since this is a performance-critical structure that is used in the inner loop of query execution.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ColumnVector.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean[]` | `isNull`
    `boolean` | `isRepeating`
    `boolean` | `noNulls`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColumnVector(int len)` Constructor for super-class ColumnVector.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `ensureSize(int size, boolean presesrveData)` Ensure the ColumnVector can hold at least size values.
    `abstract void` | `flatten(boolean selectedInUse, int[] sel, int size)`
    `protected void` | `flattenNoNulls(boolean selectedInUse, int[] sel, int size)`
    `protected void` | `flattenPush()`
    `protected void` | `flattenRepeatingNulls(boolean selectedInUse, int[] sel, int size)`
    `void` | `init()` Initialize the column vector.
    `void` | `reset()` Resets the column to default state - fills the isNull array with false - sets noNulls to true - sets isRepeating to false
    `abstract void` | `setElement(int outElementNum, int inputElementNum, ColumnVector inputVector)` Set the element in this column vector from the given input vector.
    `void` | `setRepeating(boolean isRepeating)` Sets the isRepeating flag.
    `abstract void` | `stringifyValue(StringBuilder buffer, int row)` Print the value for this column into the given string builder.
    `void` | `unFlatten()` Restore the state of isRepeating and noNulls to what it was before flattening.

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

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

- - ### Field Detail

    - #### isNull

          public boolean[] isNull

    - #### noNulls

          public boolean noNulls

    - #### isRepeating

          public boolean isRepeating

  - ### Constructor Detail

    - #### ColumnVector

          public ColumnVector(int len)

      Constructor for super-class ColumnVector. This is not called directly, but used to initialize inherited fields.
      Parameters:
        `len` - Vector length

  - ### Method Detail

    - #### reset

          public void reset()

      Resets the column to default state - fills the isNull array with false - sets noNulls to true - sets isRepeating to false

    - #### setRepeating

          public void setRepeating(boolean isRepeating)

      Sets the isRepeating flag. Recurses over structs and unions so that the flags are set correctly.
      Parameters:
        `isRepeating` -

    - #### flatten

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

    - #### flattenRepeatingNulls

          protected void flattenRepeatingNulls(boolean selectedInUse,
                                               int[] sel,
                                               int size)

    - #### flattenNoNulls

          protected void flattenNoNulls(boolean selectedInUse,
                                        int[] sel,
                                        int size)

    - #### unFlatten

          public void unFlatten()

      Restore the state of isRepeating and noNulls to what it was before flattening. This must only be called just after flattening and then evaluating a VectorExpression on the column vector. It is an optimization that allows other operations on the same column to continue to benefit from the isRepeating and noNulls indicators.

    - #### flattenPush

          protected void flattenPush()

    - #### setElement

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

      Set the element in this column vector from the given input vector. This method can assume that the output does not have isRepeating set.

    - #### init

          public void init()

      Initialize the column vector. This method can be overridden by specific column vector types. Use this method only if the individual type of the column vector is not known, otherwise its preferable to call specific initialization methods.

    - #### ensureSize

          public void ensureSize(int size,
                                 boolean presesrveData)

      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.
      Parameters:
        `size` - the new minimum size
        `presesrveData` - should the old data be preserved?

    - #### stringifyValue

          public abstract void stringifyValue(StringBuilder buffer,
                                              int row)

      Print the value for this column into the given string builder.
      Parameters:
        `buffer` - the buffer to print into
        `row` - the id of the row to print

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