private void addTopLevelConversion(int logicalColumnIndex, TypeInfo targetTypeInfo) {

    final Field field = topLevelFields[logicalColumnIndex];
    field.setIsConvert(true);

    if (field.getIsPrimitive()) {

      PrimitiveTypeInfo targetPrimitiveTypeInfo = (PrimitiveTypeInfo) targetTypeInfo;
      switch (targetPrimitiveTypeInfo.getPrimitiveCategory()) {
      case CHAR:
        field.setMaxLength(((CharTypeInfo) targetPrimitiveTypeInfo).getLength());
        break;
      case VARCHAR:
        field.setMaxLength(((VarcharTypeInfo) targetPrimitiveTypeInfo).getLength());
        break;
      default:
        // No additional data type specific setting.
        break;
      }
      field.setConversionWritable(
          VectorizedBatchUtil.getPrimitiveWritable(field.getPrimitiveCategory()));
    }
  }
@param deserializeRead   Set useExternalBuffer to true to avoid buffer copying and to get
    more efficient reading.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorDeserializeRow.java