use of org.apache.hadoop.hive.ql.QTestProcessExecResult 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.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.
the class CoreHBaseCliDriver method runTest.
@Override
public void runTest(String tname, String fname, String fpath) {
long startTime = System.currentTimeMillis();
try {
System.err.println("Begin query: " + fname);
qt.setInputFile(fpath);
qt.cliInit();
try {
qt.executeClient();
} catch (CommandProcessorException e) {
qt.failedQuery(e.getCause(), e.getResponseCode(), fname, null);
}
QTestProcessExecResult result = qt.checkCliDriverResults();
if (result.getReturnCode() != 0) {
qt.failedDiff(result.getReturnCode(), fname, result.getCapturedOutput());
}
} catch (Exception e) {
qt.failedWithException(e, fname, null);
}
long elapsedTime = System.currentTimeMillis() - startTime;
System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
assertTrue("Test passed", true);
}
use of org.apache.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.
the class CoreKuduCliDriver method runTest.
@Override
public void runTest(String tname, String fname, String fpath) {
long startTime = System.currentTimeMillis();
try {
System.err.println("Begin query: " + fname);
qt.setInputFile(fpath);
qt.cliInit();
try {
qt.executeClient();
} catch (CommandProcessorException e) {
qt.failedQuery(e.getCause(), e.getResponseCode(), fname, null);
}
QTestProcessExecResult result = qt.checkCliDriverResults();
if (result.getReturnCode() != 0) {
qt.failedDiff(result.getReturnCode(), fname, result.getCapturedOutput());
}
qt.clearPostTestEffects();
} catch (Exception e) {
qt.failedWithException(e, fname, null);
}
long elapsedTime = System.currentTimeMillis() - startTime;
System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
assertTrue("Test passed", true);
}
use of org.apache.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.
the class CoreAccumuloCliDriver method runTest.
@Override
public void runTest(String tname, String fname, String fpath) {
long startTime = System.currentTimeMillis();
try {
System.err.println("Begin query: " + fname);
qt.setInputFile(fpath);
qt.cliInit();
try {
qt.executeClient();
} catch (CommandProcessorException e) {
qt.failedQuery(e.getCause(), e.getResponseCode(), fname, null);
}
QTestProcessExecResult result = qt.checkCliDriverResults();
if (result.getReturnCode() != 0) {
qt.failedDiff(result.getReturnCode(), fname, result.getCapturedOutput());
}
qt.clearPostTestEffects();
} catch (AssumptionViolatedException e) {
throw e;
} catch (Exception e) {
qt.failedWithException(e, fname, null);
}
long elapsedTime = System.currentTimeMillis() - startTime;
System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
assertTrue("Test passed", true);
}
use of org.apache.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.
the class CoreCliDriver method runTest.
@Override
public void runTest(String testName, String fname, String fpath) {
Stopwatch sw = Stopwatch.createStarted();
boolean skipped = false;
boolean failed = false;
try {
LOG.info("Begin query: " + fname);
System.err.println("Begin query: " + fname);
qt.setInputFile(fpath);
qt.cliInit();
try {
qt.executeClient();
} catch (CommandProcessorException e) {
failed = true;
qt.failedQuery(e.getCause(), e.getResponseCode(), fname, QTestUtil.DEBUG_HINT);
}
setupAdditionalPartialMasks();
QTestProcessExecResult result = qt.checkCliDriverResults();
resetAdditionalPartialMasks();
if (result.getReturnCode() != 0) {
failed = true;
String message = Strings.isNullOrEmpty(result.getCapturedOutput()) ? QTestUtil.DEBUG_HINT : "\r\n" + result.getCapturedOutput();
qt.failedDiff(result.getReturnCode(), fname, message);
}
} catch (AssumptionViolatedException e) {
skipped = true;
throw e;
} catch (Exception e) {
failed = true;
qt.failedWithException(e, fname, QTestUtil.DEBUG_HINT);
} finally {
String message = "Done query " + fname + ". succeeded=" + !failed + ", skipped=" + skipped + ". ElapsedTime(ms)=" + sw.stop().elapsed(TimeUnit.MILLISECONDS);
LOG.info(message);
System.err.println(message);
}
assertTrue("Test passed", true);
}
Aggregations