@VisibleForTesting CommandProcessorResponse run(SessionState ss, String command) { CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.RESET, Arrays.asList(command)); if (authErrResp != null) {
CommandUtil.authorizeCommand(ss, HiveOperationType.RESET, Arrays.asList(command)); if (authErrResp != null) {
CommandUtil.authorizeCommand(ss, HiveOperationType.COMPILE, Arrays.asList(command)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.COMPILE, Arrays.asList(command)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.ADD, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.DELETE, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.DFS, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.DELETE, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.DFS, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.ADD, Arrays.asList(tokens)); if(authErrResp != null){
CommandUtil.authorizeCommand(ss, HiveOperationType.COMPILE, Arrays.asList(command)); if(authErrResp != null){
@Override public CommandProcessorResponse run(String command) { try { SessionState ss = SessionState.get(); command = new VariableSubstitution().substitute(ss.getConf(),command); String[] tokens = command.split("\\s+"); CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.DFS, Arrays.asList(tokens)); if(authErrResp != null){ // there was an authorization issue return authErrResp; } PrintStream oldOut = System.out; if (ss != null && ss.out != null) { System.setOut(ss.out); } int ret = dfs.run(tokens); if (ret != 0) { console.printError("Command failed with exit code = " + ret); } System.setOut(oldOut); return new CommandProcessorResponse(ret, null, null, dfsSchema); } catch (Exception e) { console.printError("Exception raised from DFSShell.run " + e.getLocalizedMessage(), org.apache.hadoop.util.StringUtils .stringifyException(e)); return new CommandProcessorResponse(1); } }
@Override public CommandProcessorResponse run(String command) throws CommandNeedRetryException { SessionState ss = SessionState.get(); CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.RESET, Arrays.asList(command)); if(authErrResp != null){ // there was an authorization issue return authErrResp; } if (ss.getOverriddenConfigurations().isEmpty()) { return new CommandProcessorResponse(0); } HiveConf conf = new HiveConf(); for (String key : ss.getOverriddenConfigurations().keySet()) { String value = conf.get(key); if (value != null) { ss.getConf().set(key, value); } } ss.getOverriddenConfigurations().clear(); return new CommandProcessorResponse(0); } }
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution().substitute(ss.getConf(),command); String[] tokens = command.split("\\s+"); SessionState.ResourceType t; if (tokens.length < 2 || (t = SessionState.find_resource_type(tokens[0])) == null) { console.printError("Usage: add [" + StringUtils.join(SessionState.ResourceType.values(), "|") + "] <value> [<value>]*"); return new CommandProcessorResponse(1); } CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.ADD, Arrays.asList(tokens)); if(authErrResp != null){ // there was an authorization issue return authErrResp; } try { ss.add_resources(t, Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length))); } catch (Exception e) { return CommandProcessorResponse.create(e); } return new CommandProcessorResponse(0); }
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution().substitute(ss.getConf(),command); String[] tokens = command.split("\\s+"); SessionState.ResourceType t; if (tokens.length < 1 || (t = SessionState.find_resource_type(tokens[0])) == null) { console.printError("Usage: delete [" + StringUtils.join(SessionState.ResourceType.values(), "|") + "] <value> [<value>]*"); return new CommandProcessorResponse(1); } CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.DELETE, Arrays.asList(tokens)); if(authErrResp != null){ // there was an authorization issue return authErrResp; } if (tokens.length >= 2) { ss.delete_resources(t, Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length))); } else { ss.delete_resources(t); } return new CommandProcessorResponse(0); } }