tkalkirill commented on code in PR #13311:
URL: https://github.com/apache/ignite/pull/13311#discussion_r3720770045


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java:
##########
@@ -53,26 +58,26 @@ public class SortNode<Row> extends MemoryTrackingNode<Row> 
implements SingleNode
      * @param ctx Execution context.
      * @param comp Rows comparator.
      * @param offset Offset.
-     * @param fetch Limit.
+     * @param fetch How many rows need to be processed, {@code -1} if param is 
undefined.

Review Comment:
   ```suggestion
        * @param fetch How many rows need to be processed, {@link 
#FETCH_DEFAULT} if param is undefined.
   ```



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitNode.java:
##########
@@ -17,66 +17,79 @@
 
 package org.apache.ignite.internal.processors.query.calcite.exec.rel;
 
-import java.util.function.Supplier;
 import org.apache.calcite.rel.type.RelDataType;
 import 
org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
+import org.apache.ignite.internal.processors.query.calcite.util.IgniteMath;
 import org.apache.ignite.internal.util.typedef.F;
-import org.jetbrains.annotations.Nullable;
 
 /** Offset, fetch|limit support node. */
 public class LimitNode<Row> extends AbstractNode<Row> implements 
SingleNode<Row>, Downstream<Row> {
-    /** Offset if its present, otherwise 0. */
-    private final int offset;
+    /** */
+    public static final long FETCH_DEFAULT = -1;
 
-    /** Fetch if its present, otherwise 0. */
-    private final int fetch;
+    /** */
+    public static final long OFFSET_DEFAULT = 0;
 
-    /** Already processed (pushed to upstream) rows count. */
-    private int rowsProcessed;
+    /** Offset param. */
+    private final long offset;
 
-    /** Fetch can be unset, in this case we need all rows. */
-    private @Nullable Supplier<Integer> fetchNode;
+    /** How many rows need to be processed, if {@code 0} it depends on {@link 
#rowsSummary}. */
+    private final long fetch;
+
+    /** Summary rows to process. */
+    private final long rowsSummary;
+
+    /** Already processed (pushed to downstream) rows count. */
+    private long rowsProcessed;
 
     /** Waiting results counter. */
     private int waiting;
 
+    /** Upper requested rows. */
+    private int requested;
+
     /**
      * Constructor.
      *
      * @param ctx Execution context.
      * @param rowType Row type.
+     * @param offset How many rows need to be skipped.
+     * @param fetch How many rows need to be processed, {@code -1} if param is 
undefined.

Review Comment:
   ```suggestion
        * @param fetch How many rows need to be processed, {@link 
#FETCH_DEFAULT} if param is undefined.
   ```



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java:
##########
@@ -81,7 +86,7 @@ public SortNode(
      * @param comp Rows comparator.
      */
     public SortNode(ExecutionContext<Row> ctx, RelDataType rowType, 
Comparator<Row> comp) {
-        this(ctx, rowType, comp, null, null);
+        this(ctx, rowType, comp, 0, -1);

Review Comment:
   ```suggestion
           this(ctx, rowType, comp, OFFSET_DEFAULT, FETCH_DEFAULT);
   ```



-- 
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]

Reply via email to