private T interpretNodeAsConstant(PrimitiveTypeInfo targetType, T constChild,
        boolean isEqual) throws SemanticException {
      if (exprFactory.isConstantExpr(constChild)) {
        // Try to narrow type of constant
        Object constVal = exprFactory.getConstantValue(constChild);
        if (constVal == null) {
          // adjust type of null
          return exprFactory.createConstantExpr(targetType, null);
        }
        PrimitiveTypeInfo sourceType =
            (PrimitiveTypeInfo) exprFactory.getTypeInfo(constChild);
        Object newConst = exprFactory.interpretConstantAsPrimitive(
            targetType, constVal, sourceType, isEqual);
        if (newConst == null) {
          return null;
        }
        if (newConst == constVal) {
          return constChild;
        } else {
          return exprFactory.createConstantExpr(exprFactory.adjustConstantType(targetType, newConst), newConst);
        }
      }
      return constChild;
    }
Interprets the given value as the input columnDesc if possible.
Otherwise, returns input valueDesc as is.
ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java