diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java index 905817d..32afda5 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java @@ -916,17 +916,24 @@ public int execute(String tname) { private static final String CRLF = System.getProperty("line.separator"); public int executeClient(String tname1, String tname2) { - List commandList = new ArrayList(); - - commandList.addAll(getCommands(tname1)); - commandList.add(CRLF); - commandList.addAll(getCommands(tname2)); - - return executeClient(commandList); + if(clusterType == MiniClusterType.encrypted){ + List commandList = new ArrayList(); + commandList.addAll(getCommands(tname1)); + commandList.add(CRLF); + commandList.addAll(getCommands(tname2)); + return executeClient(commandList); + }else{ + String commands = getCommand(tname1) + CRLF + getCommand(tname2); + return cliDriver.processLine(commands); + } } public int executeClient(String tname) { - return executeClient(getCommands(tname)); + if(clusterType == MiniClusterType.encrypted){ + return executeClient(getCommands(tname)); + }else{ + return cliDriver.processLine(getCommand(tname)); + } } public int executeClient(final List commandList) { @@ -998,6 +1005,21 @@ private boolean isCommandUsedForTesting(final String command) { return testCommand != null; } + private String getCommand(String tname) { + String commands = qMap.get(tname); + StringBuilder newCommands = new StringBuilder(commands.length()); + int lastMatchEnd = 0; + Matcher commentMatcher = Pattern.compile("^--.*$", Pattern.MULTILINE).matcher(commands); + while (commentMatcher.find()) { + newCommands.append(commands.substring(lastMatchEnd, commentMatcher.start())); + newCommands.append(commentMatcher.group().replaceAll("(? getCommands(final String testName) { List commandList = new ArrayList(); String testCommands = qMap.get(testName);