protected final void printDirect(String out) { super.println(out); }
@Override public void println(String out) { output.add(out); super.println(out); }
private void writeTestOutput(final String msg) { SessionState.get().out.println(msg); }
private void writeTestOutput(final String msg) { SessionState.get().out.println(msg); }
private void llapCachePurge(final SessionState ss, final LlapRegistryService llapRegistryService) throws Exception { ExecutorService executorService = Executors.newCachedThreadPool(); List<Future<Long>> futures = new ArrayList<>(); Collection<LlapServiceInstance> instances = llapRegistryService.getInstances().getAll(); for (LlapServiceInstance instance : instances) { futures.add(executorService.submit(new PurgeCallable(ss.getConf(), instance))); } int i = 0; for (LlapServiceInstance instance : instances) { Future<Long> future = futures.get(i); ss.out.println(Joiner.on("\t").join(instance.getHost(), future.get())); i++; } }
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); String[] tokens = command.split("\\s+"); SessionState.ResourceType t; if (tokens.length < 1 || (t = SessionState.find_resource_type(tokens[0])) == null) { String message = "Usage: list [" + StringUtils.join(SessionState.ResourceType.values(), "|") + "] [<value> [<value>]*]"; return new CommandProcessorResponse(1, message, null); } List<String> filter = null; if (tokens.length > 1) { filter = Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length)); } Set<String> s = ss.list_resource(t, filter); if (s != null && !s.isEmpty()) { ss.out.println(StringUtils.join(s, "\n")); } return new CommandProcessorResponse(0, null, null, SCHEMA); }
private void dumpOption(String s) { SessionState ss = SessionState.get(); if (ss.getConf().isHiddenConfig(s)) { ss.out.println(s + " is a hidden config"); } else if (ss.getConf().get(s) != null) { if (ss.getConf().isEncodedPar(s)) { ss.out.println(s + "=" + HiveConf.EncoderDecoderFactory.URL_ENCODER_DECODER .decode(ss.getConf().get(s))); } else { ss.out.println(s + "=" + ss.getConf().get(s)); } } else if (ss.getHiveVariables().containsKey(s)) { ss.out.println(s + "=" + ss.getHiveVariables().get(s)); } else { ss.out.println(s + " is undefined"); } }
private CommandProcessorResponse getVariable(String varname) throws Exception { SessionState ss = SessionState.get(); if (varname.equals("silent")){ ss.out.println("silent" + "=" + ss.getIsSilent()); return createProcessorSuccessResponse(); if (result != null) { if(isHidden(propName)) { ss.out.println(SYSTEM_PREFIX + propName + " is a hidden config"); } else { ss.out.println(SYSTEM_PREFIX + propName + "=" + result); ss.out.println(propName + " is undefined as a system property"); return new CommandProcessorResponse(1); if (System.getenv(var) != null) { if(isHidden(var)) { ss.out.println(ENV_PREFIX + var + " is a hidden config"); } else { ss.out.println(ENV_PREFIX + var + "=" + System.getenv(var)); ss.out.println(varname + " is undefined as an environmental variable"); return new CommandProcessorResponse(1); String var = varname.substring(HIVECONF_PREFIX.length()); if (ss.getConf().isHiddenConfig(var)) { ss.out.println(HIVECONF_PREFIX + var + " is a hidden config"); return createProcessorSuccessResponse(); } if (ss.getConf().get(var) != null) { ss.out.println(HIVECONF_PREFIX + var + "=" + ss.getConf().get(var));
while (driver.getResults(res)) { for (String r : res) { ss.out.println(r); ss.err.println("Failed with exception " + e.getClass().getName() + ":" + e.getMessage() + "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e)); ret = 1; if (end > start) { double timeTaken = (end - start) / 1000.0; ss.err.println("Time taken: " + timeTaken + " seconds");
SessionState ss = SessionState.get(); if (varvalue.contains("\n")){ ss.err.println("Warning: Value had a \\n character in it."); ss.err.println("env:* variables can not be set."); return new CommandProcessorResponse(1); // Should we propagate the error message properly? } else if (varname.startsWith(SYSTEM_PREFIX)){
ss.err.println(String.format("Failed to set permissions/groups on TABLE: <%s> %s", tblName, e.getMessage())); try { // We need to drop the table. if (null != db) { ss.err.println(String.format("Failed to drop TABLE <%s> after failing to set permissions/groups on it. %s", tblName, e.getMessage())); ss.err.println(String.format("Failed to set permissions and/or group on DB: <%s> %s", dbName, e.getMessage())); try { Hive.get().dropDatabase(dbName); } catch (Exception e1) { ss.err.println(String.format("Failed to drop DB <%s> after failing to set permissions/group on it. %s", dbName, e1.getMessage()));
private static void validatePermissions(CliSessionState ss, HiveConf conf, String perms) { perms = perms.trim(); FsPermission fp = null; if (perms.matches("^\\s*([r,w,x,-]{9})\\s*$")) { fp = FsPermission.valueOf("d" + perms); } else if (perms.matches("^\\s*([0-7]{3})\\s*$")) { fp = new FsPermission(Short.decode("0" + perms)); } else { ss.err.println("Invalid permission specification: " + perms); sysExit(ss,1); } if (!HCatUtil.validateMorePermissive(fp.getUserAction(), fp.getGroupAction())) { ss.err.println("Invalid permission specification: " + perms + " : user permissions must be more permissive than group permission "); sysExit(ss,1); } if (!HCatUtil.validateMorePermissive(fp.getGroupAction(), fp.getOtherAction())) { ss.err.println("Invalid permission specification: " + perms + " : group permissions must be more permissive than other permission "); sysExit(ss,1); } if ((!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getUserAction())) || (!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getGroupAction())) || (!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getOtherAction()))) { ss.err.println("Invalid permission specification: " + perms + " : permissions must have execute permissions if read or write permissions are specified "); sysExit(ss,1); } conf.set(HCatConstants.HCAT_PERMS, "d" + fp.toString()); }
ss.err.println("The '-e' and '-f' options cannot be specified simultaneously"); printUsage(options, ss.err); sysExit(ss, 1); ss.err.println("Input file not found. (" + e.getMessage() + ")"); sysExit(ss, 1); } catch (IOException e) { ss.err.println("Could not open input file for reading. (" + e.getMessage() + ")"); sysExit(ss, 1);
llapRegistryService.getApplicationId().toString(); for (LlapServiceInstance instance : llapRegistryService.getInstances().getAll()) { ss.out.println(Joiner.on("\t").join(appId, instance.getWorkerIdentity(), instance.getHost(), instance.getRpcPort(), instance.getResource().getMemory() * 1024L * 1024L, instance.getResource().getVirtualCores()));