pvary commented on code in PR #3289:
URL: https://github.com/apache/hive/pull/3289#discussion_r904754762
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java:
##########
@@ -134,39 +121,18 @@ public void setMaxRows(int maxRows) {
this.maxRows = maxRows;
}
- public boolean fetch(List res) throws IOException {
- sink.reset(res);
- int rowsRet = work.getLeastNumRows();
- if (rowsRet <= 0) {
- rowsRet = work.getLimit() >= 0 ? Math.min(work.getLimit() - totalRows,
maxRows) : maxRows;
- }
- try {
- if (rowsRet <= 0 || work.getLimit() == totalRows) {
- fetch.clearFetchContext();
+ public boolean fetch(List res) {
+ if (cachingEnabled) {
+ if (currentRow >= fetchedData.size()) {
return false;
}
- boolean fetched = false;
- while (sink.getNumRows() < rowsRet) {
- if (!fetch.pushRow()) {
- if (work.getLeastNumRows() > 0) {
- throw new HiveException("leastNumRows check failed");
- }
-
- // Closing the operator can sometimes yield more rows (HIVE-11892)
- fetch.closeOperator();
-
- return fetched;
- }
- fetched = true;
- }
- return true;
- } catch (IOException e) {
- throw e;
- } catch (Exception e) {
- throw new IOException(e);
- } finally {
- totalRows += sink.getNumRows();
+ int toIndex = Math.min(fetchedData.size(), currentRow + maxRows);
+ res.addAll(fetchedData.subList(currentRow, toIndex));
+ currentRow = toIndex;
+ } else {
+ executeInner(res);
Review Comment:
Wasn't this planned as:
```
return executeInner(res);
```
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]