public void resetValid(int newValidCapacity) {
    ensureCapacity(newValidCapacity);
    valid = newValidCapacity;
  }
enlarge the capacity if necessary, to ensure that it can hold the number of
elements specified by newValidCapacity argument. It will also narrow the
valid capacity when needed. Notice: it only enlarge or narrow the valid
capacity with no care of the already stored invalid BytesRefWritable.

@param newValidCapacity
         the desired capacity
serde/src/java/org/apache/hadoop/hive/serde2/columnar/BytesRefArrayWritable.java