public static String escapeHiveCommand(String str) {
    return ESCAPE_HIVE_COMMAND.translate(str);
  }
Escape non-unicode characters, and ', and ;
Like StringEscapeUtil.escapeJava() will escape
unicode characters as well but in some cases it's not desired.

@param str Original string
@return Escaped string
common/src/java/org/apache/hive/common/util/HiveStringUtils.java