Search in sources :

Example 6 with CommandProcessorException

use of org.apache.hadoop.hive.ql.processors.CommandProcessorException 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);
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException)

Example 7 with CommandProcessorException

use of org.apache.hadoop.hive.ql.processors.CommandProcessorException 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);
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) Stopwatch(com.google.common.base.Stopwatch) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException)

Example 8 with CommandProcessorException

use of org.apache.hadoop.hive.ql.processors.CommandProcessorException in project hive by apache.

the class CoreHBaseNegativeCliDriver 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();
            qt.failed(fname, null);
        } catch (CommandProcessorException e) {
        // this is the expected result
        }
        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);
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException)

Example 9 with CommandProcessorException

use of org.apache.hadoop.hive.ql.processors.CommandProcessorException in project hive by apache.

the class CorePerfCliDriver method runTest.

@Override
public void runTest(String name, String fname, String fpath) {
    long startTime = System.currentTimeMillis();
    try {
        LOG.info("Begin query: " + fname);
        qt.setInputFile(fpath);
        qt.cliInit();
        try {
            qt.executeClient();
        } catch (CommandProcessorException e) {
            qt.failedQuery(e.getCause(), e.getResponseCode(), fname, QTestUtil.DEBUG_HINT);
        }
        QTestProcessExecResult result = qt.checkCliDriverResults();
        if (result.getReturnCode() != 0) {
            String message = Strings.isNullOrEmpty(result.getCapturedOutput()) ? QTestUtil.DEBUG_HINT : "\r\n" + result.getCapturedOutput();
            qt.failedDiff(result.getReturnCode(), fname, message);
        }
    } catch (AssumptionViolatedException e) {
        throw e;
    } catch (Exception e) {
        qt.failedWithException(e, fname, QTestUtil.DEBUG_HINT);
    }
    long elapsedTime = System.currentTimeMillis() - startTime;
    LOG.info("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException)

Example 10 with CommandProcessorException

use of org.apache.hadoop.hive.ql.processors.CommandProcessorException in project hive by apache.

the class QTestDatasetHandler method initDataset.

public boolean initDataset(String table, CliDriver cliDriver) throws Exception {
    File tableFile = new File(new File(datasetDir, table), Dataset.INIT_FILE_NAME);
    String commands = null;
    try {
        commands = FileUtils.readFileToString(tableFile);
    } catch (IOException e) {
        throw new RuntimeException(String.format("dataset file not found %s", tableFile), e);
    }
    try {
        CommandProcessorResponse result = cliDriver.processLine(commands);
        LOG.info("Result from cliDrriver.processLine in initFromDatasets=" + result);
    } catch (CommandProcessorException e) {
        Assert.fail("Failed during initFromDatasets processLine with code=" + e);
    }
    return true;
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) CommandProcessorResponse(org.apache.hadoop.hive.ql.processors.CommandProcessorResponse) IOException(java.io.IOException) File(java.io.File)

Aggregations

CommandProcessorException (org.apache.hadoop.hive.ql.processors.CommandProcessorException)85 Test (org.junit.Test)42 IOException (java.io.IOException)14 CommandProcessorResponse (org.apache.hadoop.hive.ql.processors.CommandProcessorResponse)14 Driver (org.apache.hadoop.hive.ql.Driver)12 ArrayList (java.util.ArrayList)10 HiveConf (org.apache.hadoop.hive.conf.HiveConf)10 QTestProcessExecResult (org.apache.hadoop.hive.ql.QTestProcessExecResult)9 Path (org.apache.hadoop.fs.Path)8 FileSystem (org.apache.hadoop.fs.FileSystem)7 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)6 File (java.io.File)5 IDriver (org.apache.hadoop.hive.ql.IDriver)5 FileNotFoundException (java.io.FileNotFoundException)4 LockException (org.apache.hadoop.hive.ql.lockmgr.LockException)4 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Map (java.util.Map)3 Nullable (javax.annotation.Nullable)3 Database (org.apache.hadoop.hive.metastore.api.Database)3