public static ExprNodeDesc foldExpr(ExprNodeGenericFuncDesc funcDesc) {
    GenericUDF udf = funcDesc.getGenericUDF();
    if (!isConstantFoldableUdf(udf, funcDesc.getChildren())) {
      return funcDesc;
    }
    return evaluateFunction(funcDesc.getGenericUDF(),funcDesc.getChildren(), funcDesc.getChildren());
  }
Cast type from expression type to expected type ti.

@param desc constant expression
@param ti expected type info
@param performSafeTypeCast when true then don't perform typecast because it could be unsafe (loosing leading zeroes etc.)
@return cast constant, or null if the type cast failed.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java