public static void accountForOverflowDouble(TypeInfo outputTypeInfo, DoubleColumnVector v,
      boolean selectedInUse, int[] sel, int n) {
    if (outputTypeInfo == null) {
      //can't do much if outputTypeInfo is not set
      return;
    }
    switch (outputTypeInfo.getTypeName()) {
    case serdeConstants.FLOAT_TYPE_NAME:
      //float
      if (v.isRepeating) {
        v.vector[0] = (float) v.vector[0];
      } else if (selectedInUse) {
        for (int j = 0; j != n; j++) {
          int i = sel[j];
          v.vector[i] = (float) v.vector[i];
        }
      } else {
        for (int i = 0; i != n; i++) {
          v.vector[i] = (float) v.vector[i];
        }
      }
      break;
    default:
      //nothing to be done
    }
  }
Utility methods to handle integer overflow/underflows in a ColumnVector.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/OverflowUtils.java