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