You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/10/23 17:17:33 UTC

[GitHub] [phoenix] gokceni commented on a change in pull request #936: PHOENIX-5998 Paged server side ungrouped aggregate operations

gokceni commented on a change in pull request #936:
URL: https://github.com/apache/phoenix/pull/936#discussion_r511027115



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/iterate/UngroupedAggregatingResultIterator.java
##########
@@ -36,19 +37,33 @@ public UngroupedAggregatingResultIterator( PeekingResultIterator resultIterator,
     
     @Override
     public Tuple next() throws SQLException {
-        Tuple result = super.next();
+        byte[] value;
+        Tuple result = resultIterator.next();
+        // We should reset ClientAggregators here in case they are being reused in a new ResultIterator.
+        aggregators.reset(aggregators.getAggregators());
         // Ensure ungrouped aggregregation always returns a row, even if the underlying iterator doesn't.
-        if (result == null && !hasRows) {
-            // We should reset ClientAggregators here in case they are being reused in a new ResultIterator.
-            aggregators.reset(aggregators.getAggregators());
-            byte[] value = aggregators.toBytes(aggregators.getAggregators());
-            result = new SingleKeyValueTuple(
-                    KeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, 
-                            SINGLE_COLUMN_FAMILY, 
-                            SINGLE_COLUMN, 
-                            AGG_TIMESTAMP, 
-                            value));
+        if (result == null) {
+            if (hasRows) {
+                return null;

Review comment:
       This doesn't match with the above comment of always returning rows.




----------------------------------------------------------------
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:
users@infra.apache.org