* row to fetch or numRows == 0.
* @throws HiveServerException Invalid value for numRows (numRows < 0)
*/
public List<String> fetchN(int numRows) throws HiveServerException, TException {
if (numRows < 0) {
HiveServerException ex = new HiveServerException();
ex.setMessage("Invalid argument for number of rows: " + numRows);
throw ex;
}
if (!isHiveQuery)
// Return no results if the last command was not a Hive query
return new Vector<String>();
Vector<String> result = new Vector<String>();
driver.setMaxRows(numRows);
try {
driver.getResults(result);
} catch (IOException e) {
HiveServerException ex = new HiveServerException();
ex.setMessage(e.getMessage());
throw ex;
}
return result;
}