private boolean isExcludedFromCast(GenericUDF genericUDF) {
    boolean ret = castExpressionUdfs.contains(genericUDF.getClass())
        || (genericUDF instanceof GenericUDFRound) || (genericUDF instanceof GenericUDFBetween);

    if (ret) {
      return true;
    }

    if (genericUDF instanceof GenericUDFBridge) {
      Class<?> udfClass = ((GenericUDFBridge) genericUDF).getUdfClass();
      return castExpressionUdfs.contains(udfClass)
          || UDFSign.class.isAssignableFrom(udfClass);
    }
    return false;
  }
Add a cast expression to the expression tree if needed. The output of child expressions of a given UDF might
need a cast if their return type is different from the return type of the UDF.

@param genericUDF The given UDF
@param children Child expressions of the UDF that might require a cast.
@param returnType The return type of the UDF.
@return List of child expressions added with cast.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java