aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
@Override public Tuple next() throws SQLException { Tuple result = super.next(); // 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( PhoenixKeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value)); } hasRows = true; return result; }
ResultIterator scanner = new GroupedAggregatingResultIterator(new MergeSortRowKeyResultIterator(iterators), aggregators); AssertResults.assertResults(scanner, expectedResults);
@Override public Tuple next() throws SQLException { Tuple result = super.next(); // 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( PhoenixKeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value)); } hasRows = true; return result; }
aggResultIterator = new RowKeyOrderedAggregateResultIterator(iterators, aggregators); } else { aggResultIterator = new GroupedAggregatingResultIterator( new MergeSortRowKeyResultIterator(iterators, 0, this.getOrderBy() == OrderBy.REV_ROW_KEY_ORDER_BY),aggregators);
@Override public Tuple next() throws SQLException { Tuple result = super.next(); // 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( PhoenixKeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value)); } hasRows = true; return result; }
aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
aggResultIterator = new GroupedAggregatingResultIterator(LookAheadResultIterator.wrap(aggResultIterator), clientAggregators);
aggResultIterator = new RowKeyOrderedAggregateResultIterator(iterators, aggregators); } else { aggResultIterator = new GroupedAggregatingResultIterator( new MergeSortRowKeyResultIterator(iterators, 0, this.getOrderBy() == OrderBy.REV_ROW_KEY_ORDER_BY),aggregators);
aggResultIterator = new RowKeyOrderedAggregateResultIterator(iterators, aggregators); } else { aggResultIterator = new GroupedAggregatingResultIterator( new MergeSortRowKeyResultIterator(iterators, 0, this.getOrderBy() == OrderBy.REV_ROW_KEY_ORDER_BY),aggregators);