[ https://issues.apache.org/jira/browse/PHOENIX-7024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17757697#comment-17757697 ]
ASF GitHub Bot commented on PHOENIX-7024: ----------------------------------------- kadirozde commented on code in PR #1659: URL: https://github.com/apache/phoenix/pull/1659#discussion_r1302256846 ########## phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java: ########## @@ -303,12 +282,34 @@ public boolean isFilterDone() { @Override public boolean next(List<Cell> results) throws IOException { try { - if (isFilterDone()) { return false; } - for (int i = 0; i < tuple.size(); i++) { - results.add(tuple.getValue(i)); - } tuple = iterator.next(); - return !isFilterDone(); + if (isFilterDone()) { + if ((iterator.getRemainingOffset() > 0 || !foundNonDummyRow) && !lastScan) { + // we set a special cell in the result to track the offset across + // region boundaries. This cell is set when we reach the end of the + // region and the offset remaining > 0 OR the offset became 0, but we + // reached the end of the region without finding any valid (non dummy) + // rows. We couldn't find valid rows either because of paging or + // because of some filter. The client in SerialIterator expects this + // cell as the only row in the result set. If this cell is sent along + // with any additional rows then this special cell is treated as part + // of application result set. + KeyValue kv = new KeyValue(QueryConstants.OFFSET_ROW_KEY_BYTES, + QueryConstants.OFFSET_FAMILY, QueryConstants.OFFSET_COLUMN, + PInteger.INSTANCE.toBytes(iterator.getRemainingOffset())); + results.add(kv); + } + return false; + } else { + // tuple is non null Review Comment: Oh I remember isFilterDone checks for null tuple. Ignore my previous comment > Issues in ServerPaging > ---------------------- > > Key: PHOENIX-7024 > URL: https://issues.apache.org/jira/browse/PHOENIX-7024 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.16.0, 5.2.0, 5.1.3 > Reporter: Tanuj Khurana > Assignee: Tanuj Khurana > Priority: Major > > While testing server side paging introduced in PHOENIX-6211 , I set the > config *phoenix.server.page.size.ms* to 0. This effectively will page 1 row > at a time and serves as a good stress test for the paging code. During the > process, I hit multiple issues which I will address in this JIRA. -- This message was sent by Atlassian Jira (v8.20.10#820010)