kadirozde commented on a change in pull request #936:
URL: https://github.com/apache/phoenix/pull/936#discussion_r512309864
##########
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:
I did not really change the behavior here and thus I did not change the
comment. If there is no row in the table, we should still get a result object
with the zero row count. This is all what the comment tries to communicate.
----------------------------------------------------------------
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:
[email protected]