private void insertCast(String funcText, List<T> children) throws SemanticException {
      // substring, concat UDFs expect first argument as string. Therefore this method inserts explicit cast
      // to cast the first operand to string
      if (funcText.equals("substring") || funcText.equals("concat")) {
        if (children.size() > 0 && !isStringType(exprFactory.getTypeInfo(children.get(0)))) {
          T newColumn = createConversionCast(children.get(0), TypeInfoFactory.stringTypeInfo);
          children.set(0, newColumn);
        }
      }

      if (funcText.equalsIgnoreCase("and") || funcText.equalsIgnoreCase("or")
          || funcText.equalsIgnoreCase("not") || funcText.equalsIgnoreCase("!")) {
        // If the current function is a conjunction, the returning types of the children should be booleans.
        // Iterate on the children, if the result of a child expression is not a boolean, try to implicitly
        // convert the result of such a child to a boolean value.
        for (int i = 0; i < children.size(); i++) {
          T child = children.get(i);
          TypeInfo typeInfo = exprFactory.getTypeInfo(child);
          if (!TypeInfoFactory.booleanTypeInfo.accept(typeInfo)) {
            if (typeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE) {
              // For primitive types like string/double/timestamp, try to cast the result of
              // the child expression to a boolean.
              children.set(i, createConversionCast(child, TypeInfoFactory.booleanTypeInfo));
            } else {
              // For complex types like map/list/struct, create a isnotnull function on the child expression.
              child = exprFactory.createFuncCallExpr(TypeInfoFactory.booleanTypeInfo,
                  exprFactory.getFunctionInfo("isnotnull"),"isnotnull", Arrays.asList(child));
              children.set(i, child);
            }
          }
        }
      }
    }
@param column  column expression to convert
@param tableFieldTypeInfo TypeInfo to convert to
@return Expression converting column to the type specified by tableFieldTypeInfo
ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java