use of org.apache.hive.beeline.QFileBeeLineClient in project hive by apache.
the class CoreBeeLineDriver method runTest.
private void runTest(QFile qFile, List<Callable<Void>> preCommands) throws Exception {
try (QFileBeeLineClient beeLineClient = clientBuilder.getClient(qFile.getLogFile())) {
long startTime = System.currentTimeMillis();
System.err.println(">>> STARTED " + qFile.getName());
beeLineClient.execute(qFile, preCommands);
long queryEndTime = System.currentTimeMillis();
System.err.println(">>> EXECUTED " + qFile.getName() + ": " + (queryEndTime - startTime) + "ms");
qFile.filterOutput();
long filterEndTime = System.currentTimeMillis();
System.err.println(">>> FILTERED " + qFile.getName() + ": " + (filterEndTime - queryEndTime) + "ms");
if (!overwrite) {
QTestProcessExecResult result = qFile.compareResults();
long compareEndTime = System.currentTimeMillis();
System.err.println(">>> COMPARED " + qFile.getName() + ": " + (compareEndTime - filterEndTime) + "ms");
if (result.getReturnCode() == 0) {
System.err.println(">>> PASSED " + qFile.getName());
} else {
System.err.println(">>> FAILED " + qFile.getName());
String messageText = "Client result comparison failed with error code = " + result.getReturnCode() + " while executing fname=" + qFile.getName() + "\n";
String messageBody = Strings.isNullOrEmpty(result.getCapturedOutput()) ? qFile.getDebugHint() : result.getCapturedOutput();
fail(messageText + messageBody);
}
} else {
qFile.overwriteResults();
System.err.println(">>> PASSED " + qFile.getName());
}
} catch (Exception e) {
throw new Exception("Exception running or analyzing the results of the query file: " + qFile + "\n" + qFile.getDebugHint(), e);
}
}
use of org.apache.hive.beeline.QFileBeeLineClient in project hive by apache.
the class CoreBeeLineDriver method runTest.
public void runTest(QFile qFile) throws Exception {
try (QFileBeeLineClient beeLineClient = clientBuilder.getClient(qFile.getLogFile())) {
long startTime = System.currentTimeMillis();
System.err.println(">>> STARTED " + qFile.getName());
beeLineClient.execute(qFile);
long queryEndTime = System.currentTimeMillis();
System.err.println(">>> EXECUTED " + qFile.getName() + ": " + (queryEndTime - startTime) + "ms");
qFile.filterOutput();
long filterEndTime = System.currentTimeMillis();
System.err.println(">>> FILTERED " + qFile.getName() + ": " + (filterEndTime - queryEndTime) + "ms");
if (!overwrite) {
QTestProcessExecResult result = qFile.compareResults();
long compareEndTime = System.currentTimeMillis();
System.err.println(">>> COMPARED " + qFile.getName() + ": " + (compareEndTime - filterEndTime) + "ms");
if (result.getReturnCode() == 0) {
System.err.println(">>> PASSED " + qFile.getName());
} else {
System.err.println(">>> FAILED " + qFile.getName());
String messageText = "Client result comparison failed with error code = " + result.getReturnCode() + " while executing fname=" + qFile.getName() + "\n";
String messageBody = Strings.isNullOrEmpty(result.getCapturedOutput()) ? qFile.getDebugHint() : result.getCapturedOutput();
fail(messageText + messageBody);
}
} else {
qFile.overwriteResults();
System.err.println(">>> PASSED " + qFile.getName());
}
} catch (Exception e) {
throw new Exception("Exception running or analyzing the results of the query file: " + qFile + "\n" + qFile.getDebugHint(), e);
}
}
use of org.apache.hive.beeline.QFileBeeLineClient in project hive by apache.
the class CoreBeeLineDriver method runInfraScript.
protected void runInfraScript(String[] commands, File beeLineOutput, File log) throws IOException, SQLException {
try (QFileBeeLineClient beeLineClient = clientBuilder.getClient(beeLineOutput)) {
String[] preCommands = new String[] { "set hive.exec.pre.hooks=" + PreExecutePrinter.class.getName() + ";", "set test.data.dir=" + testDataDirectory + ";", "set test.script.dir=" + testScriptDirectory + ";" };
String[] allCommands = Stream.concat(Arrays.stream(preCommands), Arrays.stream(commands)).toArray(String[]::new);
beeLineClient.execute(allCommands, log, Converter.NONE);
} catch (Exception e) {
throw new SQLException("Error running infra commands, " + "\nCheck the following logs for details:\n - " + beeLineOutput + "\n - " + log, e);
}
}
Aggregations