public int processFile(String fileName) throws IOException { BufferedReader bufferedReader = null; try { bufferedReader = loadFile(fileName); return (processReader(bufferedReader)); } finally { IOUtils.closeStream(bufferedReader); } }
/** * process the Hive command by lines * @param line contains a legal Hive command * @return the return code of the execution result */ protected int processLine(String line) { int lastRet = 0, ret = 0; String command = ""; for (String oneCmd : line.split(";")) { if (StringUtils.indexOf(oneCmd, "\\") != -1) { command += StringUtils.join(oneCmd.split("\\\\")); } else { command += oneCmd; } if (StringUtils.isBlank(command)) { continue; } ret = processCmd(command); command = ""; lastRet = ret; if (ret != 0) { return ret; } } return lastRet; }
/** * execute the buffered reader which stores the commands * @param reader the buffered reader * @return the return code of the execution result * @throws IOException */ protected int processReader(BufferedReader reader) throws IOException { String line; StringBuilder qsb = new StringBuilder(); while ((line = reader.readLine()) != null) { if (!line.startsWith("--")) { qsb.append(line); } } return processLine(qsb.toString()); }
public int processFile(String fileName) throws IOException { BufferedReader bufferedReader = null; try { bufferedReader = loadFile(fileName); return (processReader(bufferedReader)); } finally { IOUtils.closeStream(bufferedReader); } }
/** * execute the buffered reader which stores the commands * @param reader the buffered reader * @return the return code of the execution result * @throws IOException */ protected int processReader(BufferedReader reader) throws IOException { String line; StringBuilder qsb = new StringBuilder(); while ((line = reader.readLine()) != null) { if (!line.startsWith("--")) { qsb.append(line); } } return processLine(qsb.toString()); }
/** * process the Hive command by lines * @param line contains a legal Hive command * @return the return code of the execution result */ protected int processLine(String line) { int lastRet = 0, ret = 0; String command = ""; for (String oneCmd : line.split(";")) { if (StringUtils.indexOf(oneCmd, "\\") != -1) { command += StringUtils.join(oneCmd.split("\\\\")); } else { command += oneCmd; } if (StringUtils.isBlank(command)) { continue; } ret = processCmd(command); command = ""; lastRet = ret; if (ret != 0) { return ret; } } return lastRet; }
public int processFile(String fileName) throws IOException { BufferedReader bufferedReader = null; try { bufferedReader = loadFile(fileName); return (processReader(bufferedReader)); } finally { IOUtils.closeStream(bufferedReader); } }
/** * execute the buffered reader which stores the commands * @param reader the buffered reader * @return the return code of the execution result * @throws IOException */ protected int processReader(BufferedReader reader) throws IOException { String line; StringBuilder qsb = new StringBuilder(); while ((line = reader.readLine()) != null) { if (!line.startsWith("--")) { qsb.append(line); } } return processLine(qsb.toString()); }
/** * process the Hive command by lines * @param line contains a legal Hive command * @return the return code of the execution result */ protected int processLine(String line) { int lastRet = 0, ret = 0; String command = ""; for (String oneCmd : line.split(";")) { if (StringUtils.indexOf(oneCmd, "\\") != -1) { command += StringUtils.join(oneCmd.split("\\\\")); } else { command += oneCmd; } if (StringUtils.isBlank(command)) { continue; } ret = processCmd(command); command = ""; lastRet = ret; if (ret != 0) { return ret; } } return lastRet; }