kadirozde commented on a change in pull request #973:
URL: https://github.com/apache/phoenix/pull/973#discussion_r545506749



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/OffsetResultIterator.java
##########
@@ -32,17 +36,27 @@
 public class OffsetResultIterator extends DelegateResultIterator {
     private int rowCount;
     private int offset;
+    private long pageSizeMs = Long.MAX_VALUE;
 
     public OffsetResultIterator(ResultIterator delegate, Integer offset) {
         super(delegate);
         this.offset = offset == null ? -1 : offset;
     }
 
+    public OffsetResultIterator(ResultIterator delegate, Integer offset, long 
pageSizeMs) {
+        this(delegate, offset);
+        this.pageSizeMs = pageSizeMs;
+    }
     @Override
     public Tuple next() throws SQLException {
+        long startTime = EnvironmentEdgeManager.currentTimeMillis();
         while (rowCount < offset) {
-            if (super.next() == null) { return null; }
+            Tuple tuple = super.next();
+            if (tuple == null) { return null; }
             rowCount++;
+            if (EnvironmentEdgeManager.currentTimeMillis() - startTime >= 
pageSizeMs) {

Review comment:
       OffsetResultIterator is also used on the server side. When it is used on 
the client side, pageSizeMs is set to Long.MAX_VALUE in the constructor.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to