zstan commented on code in PR #5479:
URL: https://github.com/apache/ignite-3/pull/5479#discussion_r2032905507
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/LimitNode.java:
##########
@@ -89,19 +93,30 @@ public void push(RowT row) throws Exception {
if (waiting == NOT_WAITING) {
return;
}
+
++rowsProcessed;
--waiting;
if (rowsProcessed > offset) {
- if (fetchNode == null || rowsProcessed <= fetch + offset) {
+ if (fetchUndefined || rowsProcessed <= fetch + offset) {
+ // this two rows can`t be swapped, cause if all requested rows
have been pushed it will trigger further request call.
+ --requested;
downstream().push(row);
}
}
- if (fetch > 0 && rowsProcessed == fetch + offset && waiting > 0) {
+ // There several cases are possible:
+ // 1) requested = 512, limit = 1, offset = not defined: need to pass
1 row and call end()
+ // 2) requested = 512, limit = 512, offset = not defined: just need
to pass all rows without end() call
+ // 3) requested = 512, limit = 512, offset = 1: need to request
initially 512 and further 1 row
+ if (fetch > 0 && rowsProcessed == fetch + offset && requested > 0) {
Review Comment:
this is not fetchNone() cause additional check : fetch > 0
--
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]