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

java.lang.Object
  extended by org.apache.hadoop.hive.ql.exec.vector.ColumnVector
Direct Known Subclasses:
BytesColumnVector, DecimalColumnVector, DoubleColumnVector, LongColumnVector

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.


Field Summary
 boolean[] isNull
           
 boolean isRepeating
           
 boolean noNulls
           
 
Constructor Summary
ColumnVector(int len)
          Constructor for super-class ColumnVector.
 
Method Summary
abstract  void flatten(boolean selectedInUse, int[] sel, int size)
           
 void flattenNoNulls(boolean selectedInUse, int[] sel, int size)
           
 void flattenRepeatingNulls(boolean selectedInUse, int[] sel, int size)
           
abstract  org.apache.hadoop.io.Writable getWritableObject(int index)
           
 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 unFlatten()
          Restore the state of isRepeating and noNulls to what it was before flattening.
 
Methods inherited from class java.lang.Object
equals, 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

getWritableObject

public abstract org.apache.hadoop.io.Writable getWritableObject(int index)

reset

public void reset()
Resets the column to default state - fills the isNull array with false - sets noNulls to true - sets isRepeating to false


flatten

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

flattenRepeatingNulls

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

flattenNoNulls

public 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.


setElement

public abstract void setElement(int outElementNum,
                                int inputElementNum,
                                ColumnVector inputVector)
Set the element in this column vector from the given input vector.


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.



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