private Field allocatePrimitiveField(TypeInfo sourceTypeInfo) {
    final PrimitiveTypeInfo sourcePrimitiveTypeInfo = (PrimitiveTypeInfo) sourceTypeInfo;
    final PrimitiveCategory sourcePrimitiveCategory = sourcePrimitiveTypeInfo.getPrimitiveCategory();
    int maxLength = 0;
    VectorBatchDeserializer deserializer;

    switch (sourcePrimitiveCategory) {
      case VOID:
        deserializer = new VectorVoidDeserializer();
        break;
      case BOOLEAN:
        deserializer = new VectorBooleanDeserializer();
        break;
      case BYTE:
        deserializer = new VectorByteDeserializer();
        break;
      case SHORT:
        deserializer = new VectorShortDeserializer();
        break;
      case INT:
        deserializer = new VectorIntDeserializer();
        break;
      case LONG:
        deserializer = new VectorLongDeserializer();
        break;
      case TIMESTAMP:
        deserializer = new VectorTimestampDeserializer();
        break;
      case DATE:
        deserializer = new VectorDateDeserializer();
        break;
      case FLOAT:
        deserializer = new VectorFloatDeserializer();
        break;
      case DOUBLE:
        deserializer = new VectorDoubleDeserializer();
        break;
      case BINARY:
        deserializer = new VectorBinaryDeserializer();
        break;
      case STRING:
        deserializer = new VectorStringDeserializer();
        break;
      case VARCHAR:
        maxLength = ((VarcharTypeInfo) sourcePrimitiveTypeInfo).getLength();
        deserializer = new VectorVarcharDeserializer();
        break;
      case CHAR:
        maxLength = ((CharTypeInfo) sourcePrimitiveTypeInfo).getLength();
        deserializer = new VectorCharDeserializer();
        break;
      case DECIMAL:
        deserializer = new VectorDecimalDeserializer();
        break;
      case INTERVAL_YEAR_MONTH:
        deserializer = new VectorIntervalYearMonthDeserializer();
        break;
      case INTERVAL_DAY_TIME:
        deserializer = new VectorIntervalDayTimeDeserializer();
        break;
      default:
        throw new RuntimeException("Primitive category " + sourcePrimitiveCategory +
                " not supported");
    }
    return new Field(sourcePrimitiveCategory, maxLength, deserializer);
  }
@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