private VectorExpression getConstantVectorExpression(Object constantValue, TypeInfo typeInfo,
      VectorExpressionDescriptor.Mode mode) throws HiveException {
    String typeName =  typeInfo.getTypeName();
    VectorExpressionDescriptor.ArgumentType vectorArgType =
        VectorExpressionDescriptor.ArgumentType.fromHiveTypeName(typeName);
    if (vectorArgType == VectorExpressionDescriptor.ArgumentType.NONE) {
      throw new HiveException("No vector argument type for type name " + typeName);
    }
    int outCol = -1;
    if (mode == VectorExpressionDescriptor.Mode.PROJECTION) {
      outCol = ocm.allocateOutputColumn(typeInfo);
    }
    if (constantValue == null) {
      if (typeInfo.getCategory() != Category.PRIMITIVE) {
        throw new HiveException("Complex type constants (" + typeInfo.getCategory() + ") not supported for type name " + typeName);
      }
      if (mode == VectorExpressionDescriptor.Mode.FILTER) {
        return new FilterConstantBooleanVectorExpression(0);
      } else {
        return new ConstantVectorExpression(outCol, typeInfo, true);
      }
    }

    // Boolean is special case.
    if (typeName.equalsIgnoreCase(serdeConstants.BOOLEAN_TYPE_NAME)) {
      if (mode == VectorExpressionDescriptor.Mode.FILTER) {
        if ((Boolean) constantValue) {
          return new FilterConstantBooleanVectorExpression(1);
        } else {
          return new FilterConstantBooleanVectorExpression(0);
        }
      } else {
        if ((Boolean) constantValue) {
          return new ConstantVectorExpression(outCol, 1, typeInfo);
        } else {
          return new ConstantVectorExpression(outCol, 0, typeInfo);
        }
      }
    }

    return ConstantVectorExpression.create(outCol, constantValue, typeInfo);
  }
Handles only the special cases of cast/+ve/-ve operator on a constant.
@param exprDesc
@return The same expression if no evaluation done, else return the constant
        expression.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java