@Override public boolean getResults(List res) throws IOException { return coreDriver.getResults(res); }
protected List<String> runStatementOnDriver(String stmt) throws Exception { LOG.info("Running the query: " + stmt); CommandProcessorResponse cpr = d.run(stmt); if(cpr.getResponseCode() != 0) { throw new RuntimeException(stmt + " failed: " + cpr); } List<String> rs = new ArrayList<String>(); d.getResults(rs); return rs; } CommandProcessorResponse runStatementOnDriverNegative(String stmt) throws Exception {
private List<String> runStatementOnDriver(String stmt) throws Exception { CommandProcessorResponse cpr = d.run(stmt); if(cpr.getResponseCode() != 0) { throw new RuntimeException(stmt + " failed: " + cpr); } List<String> rs = new ArrayList<String>(); d.getResults(rs); return rs; } @Before
protected List<String> runStatementOnDriver(String stmt) throws Exception { LOG.info("+runStatementOnDriver(" + stmt + ")"); CommandProcessorResponse cpr = d.run(stmt); if(cpr.getResponseCode() != 0) { throw new RuntimeException(stmt + " failed: " + cpr); } List<String> rs = new ArrayList<String>(); d.getResults(rs); return rs; } final void assertUniqueID(Table table) throws Exception {
@Override public void run() { SessionState ss = SessionState.start(hiveConf); try { ss.applyAuthorizationPolicy(); } catch (HiveException e) { throw new RuntimeException(e); } QueryState qs = new QueryState.Builder().withHiveConf(hiveConf).nonIsolated().build(); Driver d = new Driver(qs, null); try { LOG.info("Ready to run the query: " + query); syncThreadStart(cdlIn, cdlOut); try { CommandProcessorResponse cpr = d.run(query); if(cpr.getResponseCode() != 0) { throw new RuntimeException(query + " failed: " + cpr); } d.getResults(new ArrayList<String>()); } catch (Exception e) { throw new RuntimeException(e); } } finally { d.close(); } } }
response = driver.run(cmd); assertEquals(0, response.getResponseCode()); driver.getResults(result); assertEquals(20, result.size()); driver.close();
while (driver.getResults(new ArrayList<String>())) {
while (driver.getResults(new ArrayList<String>())) {
driver.run("select count(*) from target"); List<String> r = new ArrayList<>(); driver.getResults(r); Assert.assertEquals("", "4", r.get(0));
try { ret = proc.run(cmd).getResponseCode(); ((Driver) proc).getResults(out); } catch (CommandNeedRetryException ex) { Logger.getLogger(HiveTestEmbedded.class.getName()).log(Level.SEVERE, null, ex);
((Driver) proc).getResults(results); } else { logger.info(String.format(
ArrayList<String> res = new ArrayList<String>(); try { while (qp.getResults(res)) { ArrayList<String> resCopy = new ArrayList<String>(); resCopy.addAll(res);
ArrayList<String> res = new ArrayList<String>(); try { while (qp.getResults(res)) { ArrayList<String> resCopy = new ArrayList<String>(); resCopy.addAll(res);
private CommandProcessorResponse runExplain(String hql, HiveConf conf) throws Exception { Driver hiveDriver = new Driver(conf, "anonymous"); CommandProcessorResponse response = hiveDriver.run("EXPLAIN EXTENDED " + hql); hiveDriver.resetFetch(); hiveDriver.setMaxRows(Integer.MAX_VALUE); List<Object> explainResult = new ArrayList<Object>(); hiveDriver.getResults(explainResult); for (Object explainRow : explainResult) { // Print the following to stdout to check partition output. // Not parsing the output because it will slow down the test assertNotNull(explainRow.toString()); } return response; } }
while (qp.getResults(res)) { for (String r : res) { out.println(r);
((FetchConverter)out).fetchStarted(); while (qp.getResults(res)) { for (String r : res) { out.println(r);
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { validateDefaultFetchOrientation(orientation); assertState(OperationState.FINISHED); RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); try { /* if client is requesting fetch-from-start and its not the first time reading from this operation * then reset the fetch position to beginning */ if (orientation.equals(FetchOrientation.FETCH_FIRST) && fetchStarted) { driver.resetFetch(); } fetchStarted = true; driver.setMaxRows((int) maxRows); if (driver.getResults(convey)) { return decode(convey, rowSet); } return rowSet; } catch (IOException e) { throw new HiveSQLException(e); } catch (CommandNeedRetryException e) { throw new HiveSQLException(e); } catch (Exception e) { throw new HiveSQLException(e); } finally { convey.clear(); } }
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { validateDefaultFetchOrientation(orientation); assertState(OperationState.FINISHED); RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); try { /* if client is requesting fetch-from-start and its not the first time reading from this operation * then reset the fetch position to beginning */ if (orientation.equals(FetchOrientation.FETCH_FIRST) && fetchStarted) { driver.resetFetch(); } fetchStarted = true; driver.setMaxRows((int) maxRows); if (driver.getResults(convey)) { return decode(convey, rowSet); } return rowSet; } catch (IOException e) { throw new HiveSQLException(e); } catch (CommandNeedRetryException e) { throw new HiveSQLException(e); } catch (Exception e) { throw new HiveSQLException(e); } finally { convey.clear(); } }
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { validateDefaultFetchOrientation(orientation); assertState(OperationState.FINISHED); RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); try { /* if client is requesting fetch-from-start and its not the first time reading from this operation * then reset the fetch position to beginning */ if (orientation.equals(FetchOrientation.FETCH_FIRST) && fetchStarted) { driver.resetFetch(); } fetchStarted = true; driver.setMaxRows((int) maxRows); if (driver.getResults(convey)) { return decode(convey, rowSet); } return rowSet; } catch (IOException e) { throw new HiveSQLException(e); } catch (CommandNeedRetryException e) { throw new HiveSQLException(e); } catch (Exception e) { throw new HiveSQLException(e); } finally { convey.clear(); } }
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { validateDefaultFetchOrientation(orientation); assertState(OperationState.FINISHED); RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); try { /* if client is requesting fetch-from-start and its not the first time reading from this operation * then reset the fetch position to beginning */ if (orientation.equals(FetchOrientation.FETCH_FIRST) && fetchStarted) { driver.resetFetch(); } fetchStarted = true; driver.setMaxRows((int) maxRows); if (driver.getResults(convey)) { return decode(convey, rowSet); } return rowSet; } catch (IOException e) { throw new HiveSQLException(e); } catch (CommandNeedRetryException e) { throw new HiveSQLException(e); } catch (Exception e) { throw new HiveSQLException(e); } finally { convey.clear(); } }