code: public static int setVariable(String varname, String varvalue) throws Exception {
      SessionState ss = SessionState.get();
      if (varvalue.contains("\n")){
        ss.err.println("Warning: Value had a \\n character in it.");
      }
      varname = varname.trim();
      if (varname.startsWith(ENV_PREFIX)){
        ss.err.println("env:* variables can not be set.");
        return 1;
      } else if (varname.startsWith(SYSTEM_PREFIX)){
        String propName = varname.substring(SYSTEM_PREFIX.length());
        System.getProperties().setProperty(propName,
                new VariableSubstitution().substitute(ss.getConf(),varvalue));
      } else if (varname.startsWith(HIVECONF_PREFIX)){
        String propName = varname.substring(HIVECONF_PREFIX.length());
        setConf(varname, propName, varvalue, true);
      } else if (varname.startsWith(HIVEVAR_PREFIX)) {
        String propName = varname.substring(HIVEVAR_PREFIX.length());
        ss.getHiveVariables().put(propName,
                new VariableSubstitution().substitute(ss.getConf(),varvalue));
      } else if (varname.startsWith(METACONF_PREFIX)) {
        String propName = varname.substring(METACONF_PREFIX.length());
        Hive hive = Hive.get(ss.getConf());
        hive.setMetaConf(propName, new VariableSubstitution().substitute(ss.getConf(), varvalue));
      } else {
        setConf(varname, varname, varvalue, true);
      }
      return 0;
    }
docs: setConf(varname, propName, varvalue, true) when varname.startsWith(HIVECONF_PREFIX)