kadirozde commented on code in PR #1736:
URL: https://github.com/apache/phoenix/pull/1736#discussion_r1450753169


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/IndexerRegionScanner.java:
##########
@@ -435,12 +437,33 @@ public boolean next(List<Cell> results) throws 
IOException {
                 mutations.clear();
             }
         }
-        byte[] rowCountBytes = PLong.INSTANCE.toBytes(Long.valueOf(rowCount));
+        byte[] rowCountBytes = PLong.INSTANCE.toBytes((long) rowCount);
         final Cell aggKeyValue;
         if (lastCell == null) {
-            aggKeyValue = 
PhoenixKeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY,
-                SINGLE_COLUMN_FAMILY,
-                    SINGLE_COLUMN, AGG_TIMESTAMP, rowCountBytes,0, 
rowCountBytes.length);
+            byte[] rowKey;
+            byte[] startKey = scan.getStartRow().length > 0 ? 
scan.getStartRow() :
+                    region.getRegionInfo().getStartKey();
+            byte[] endKey = scan.getStopRow().length > 0 ? scan.getStopRow() :
+                    region.getRegionInfo().getEndKey();
+            final boolean isIncompatibleClient =
+                    
ScanUtil.isIncompatibleClientForServerReturnValidRowKey(scan);
+            if (!isIncompatibleClient) {
+                rowKey = ByteUtil.getLargestPossibleRowKeyInRange(startKey, 
endKey);
+                if (rowKey == null) {
+                    if (scan.includeStartRow()) {

Review Comment:
   If lastCell is null then there is no row left to scan. Why do we need to 
worry about the start row here? 



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