public static boolean isNumericType(PrimitiveTypeInfo typeInfo) {
    switch (typeInfo.getPrimitiveCategory()) {
      case BYTE:
      case SHORT:
      case INT:
      case LONG:
      case DECIMAL:
      case FLOAT:
      case DOUBLE:
      case STRING: // String or string equivalent is considered numeric when used in arithmetic operator.
      case VARCHAR:
      case CHAR:
      case VOID: // NULL is considered numeric type for arithmetic operators.
        return true;
      default:
        return false;
    }
  }
Check if the given type is numeric. String is considered numeric when used in
numeric operators.

@param typeInfo
@return
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java