public static ColumnVector createColumnVector(TypeInfo typeInfo,
      DataTypePhysicalVariation dataTypePhysicalVariation) {
    switch(typeInfo.getCategory()) {
    case PRIMITIVE:
      {
        PrimitiveTypeInfo primitiveTypeInfo = (PrimitiveTypeInfo) typeInfo;
        switch(primitiveTypeInfo.getPrimitiveCategory()) {
        case BOOLEAN:
        case BYTE:
        case SHORT:
        case INT:
        case LONG:
        case INTERVAL_YEAR_MONTH:
          return new LongColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case DATE:
          return new DateColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case TIMESTAMP:
          return new TimestampColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case INTERVAL_DAY_TIME:
          return new IntervalDayTimeColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case FLOAT:
        case DOUBLE:
          return new DoubleColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case BINARY:
        case STRING:
        case CHAR:
        case VARCHAR:
          return new BytesColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        case DECIMAL:
          DecimalTypeInfo tInfo = (DecimalTypeInfo) primitiveTypeInfo;
          if (dataTypePhysicalVariation == DataTypePhysicalVariation.DECIMAL_64) {
            return new Decimal64ColumnVector(VectorizedRowBatch.DEFAULT_SIZE,
                tInfo.precision(), tInfo.scale());
          } else {
            return new DecimalColumnVector(VectorizedRowBatch.DEFAULT_SIZE,
                tInfo.precision(), tInfo.scale());
          }
        case VOID:
          return new VoidColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
        default:
          throw new RuntimeException("Vectorizaton is not supported for datatype:"
              + primitiveTypeInfo.getPrimitiveCategory());
        }
      }
    case STRUCT:
      {
        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        List<TypeInfo> typeInfoList = structTypeInfo.getAllStructFieldTypeInfos();
        ColumnVector[] children = new ColumnVector[typeInfoList.size()];
        for(int i=0; i < children.length; ++i) {
          children[i] =
              createColumnVector(typeInfoList.get(i));
        }
        return new StructColumnVector(VectorizedRowBatch.DEFAULT_SIZE,
            children);
      }
    case UNION:
      {
        UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
        List<TypeInfo> typeInfoList = unionTypeInfo.getAllUnionObjectTypeInfos();
        ColumnVector[] children = new ColumnVector[typeInfoList.size()];
        for(int i=0; i < children.length; ++i) {
          children[i] = createColumnVector(typeInfoList.get(i));
        }
        return new UnionColumnVector(VectorizedRowBatch.DEFAULT_SIZE, children);
      }
    case LIST:
      {
        ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
        return new ListColumnVector(VectorizedRowBatch.DEFAULT_SIZE,
            createColumnVector(listTypeInfo.getListElementTypeInfo()));
      }
    case MAP:
      {
        MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
        return new MapColumnVector(VectorizedRowBatch.DEFAULT_SIZE,
            createColumnVector(mapTypeInfo.getMapKeyTypeInfo()),
            createColumnVector(mapTypeInfo.getMapValueTypeInfo()));
      }
    default:
      throw new RuntimeException("Vectorization is not supported for datatype:"
          + typeInfo.getCategory());
    }
  }
Reduce the batch size for a vectorized row batch
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedBatchUtil.java