@Override
  public void ensureSize(int size, boolean preserveData) {
    super.ensureSize(size, preserveData);
    if (size <= vector.length) return; // We assume the existing vector is always valid.
    HiveDecimalWritable[] oldArray = vector;
    vector = new HiveDecimalWritable[size];
    int initPos = 0;
    if (preserveData) {
      // we copy all of the values to avoid creating more objects
      // TODO: it might be cheaper to always preserve data or reset existing objects
      initPos = oldArray.length;
      System.arraycopy(oldArray, 0, vector, 0 , oldArray.length);
    }
    for (int i = initPos; i < vector.length; ++i) {
      vector[i] = new HiveDecimalWritable(0);  // Initially zero.
    }
  }
Set a decimal from a HiveDecimal.

This is a FAST version that assumes the caller has checked to make sure the hiveDec
is not null and elementNum is correctly adjusted for isRepeating.  And, that the isNull entry
has been set.

We will check for precision/scale range, so the entry's NULL may get set.
Otherwise, only the output entry fields will be set by this method.

@param elementNum
@param hiveDec
storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java