protected void func(ColumnVector outputColVector, BytesColumnVector inputColVector, int i) {
    String s;
    try {

      /* If this conversion is frequently used, this should be optimized,
       * e.g. by converting to decimal from the input bytes directly without
       * making a new string.
       */
      s = new String(inputColVector.vector[i], inputColVector.start[i], inputColVector.length[i], "UTF-8");
      ((IDecimalColumnVector) outputColVector).set(i, HiveDecimal.create(s));
    } catch (Exception e) {

      // for any exception in conversion to decimal, produce NULL
      outputColVector.noNulls = false;
      outputColVector.isNull[i] = true;
    }
  }
Convert input string to a decimal, at position i in the respective vectors.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastStringToDecimal.java