@Override public void resetFetch() throws IOException { coreDriver.resetFetch(); }
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; } }
@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(); } }