@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; } }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; }
@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; }
@Override public Tuple next() throws SQLException { Tuple result = resultIterator.next(); if (result == null) { return null; } if (currentKey.get() == UNITIALIZED_KEY_BUFFER) { getGroupingKey(result, currentKey); } Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); while (true) { aggregators.aggregate(rowAggregators, result); Tuple nextResult = resultIterator.peek(); if (nextResult == null || !currentKey.equals(getGroupingKey(nextResult, nextKey))) { break; } result = resultIterator.next(); } byte[] value = aggregators.toBytes(rowAggregators); Tuple tuple = wrapKeyValueAsResult(PhoenixKeyValueUtil.newKeyValue(currentKey, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value, 0, value.length)); currentKey.set(nextKey.get(), nextKey.getOffset(), nextKey.getLength()); return tuple; }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; } }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; } }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; }
@Override public Aggregator[] aggregate(Tuple result) { Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); aggregators.aggregate(rowAggregators, result); return rowAggregators; }
aggregators = ServerAggregators.deserialize( scan.getAttribute(BaseScannerRegionObserver.AGGREGATORS), conf, em); rowAggregators = aggregators.getAggregators(); Pair<Integer, Integer> minMaxQualifiers = EncodedColumnsUtil.getMinMaxQualifiersFromScan(scan); Tuple result = useQualifierAsIndex ? new PositionBasedMultiKeyValueTuple() : new MultiKeyValueTuple();
@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; }
@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; }
@Override public Tuple next() throws SQLException { Tuple result = resultIterator.next(); if (result == null) { return null; } if (currentKey.get() == UNITIALIZED_KEY_BUFFER) { getGroupingKey(result, currentKey); } Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); while (true) { aggregators.aggregate(rowAggregators, result); Tuple nextResult = resultIterator.peek(); if (nextResult == null || !currentKey.equals(getGroupingKey(nextResult, nextKey))) { break; } result = resultIterator.next(); } byte[] value = aggregators.toBytes(rowAggregators); Tuple tuple = wrapKeyValueAsResult(PhoenixKeyValueUtil.newKeyValue(currentKey, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value, 0, value.length)); currentKey.set(nextKey.get(), nextKey.getOffset(), nextKey.getLength()); return tuple; }
@Override public Tuple next() throws SQLException { Tuple result = resultIterator.next(); if (result == null) { return null; } if (currentKey.get() == UNITIALIZED_KEY_BUFFER) { getGroupingKey(result, currentKey); } Aggregator[] rowAggregators = aggregators.getAggregators(); aggregators.reset(rowAggregators); while (true) { aggregators.aggregate(rowAggregators, result); Tuple nextResult = resultIterator.peek(); if (nextResult == null || !currentKey.equals(getGroupingKey(nextResult, nextKey))) { break; } result = resultIterator.next(); } byte[] value = aggregators.toBytes(rowAggregators); Tuple tuple = wrapKeyValueAsResult(PhoenixKeyValueUtil.newKeyValue(currentKey, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value, 0, value.length)); currentKey.set(nextKey.get(), nextKey.getOffset(), nextKey.getLength()); return tuple; }
aggregators = ServerAggregators.deserialize( scan.getAttribute(BaseScannerRegionObserver.AGGREGATORS), conf, em); rowAggregators = aggregators.getAggregators(); Pair<Integer, Integer> minMaxQualifiers = EncodedColumnsUtil.getMinMaxQualifiersFromScan(scan); Tuple result = useQualifierAsIndex ? new PositionBasedMultiKeyValueTuple() : new MultiKeyValueTuple();
aggregators = ServerAggregators.deserialize( scan.getAttribute(BaseScannerRegionObserver.AGGREGATORS), conf, em); rowAggregators = aggregators.getAggregators(); Pair<Integer, Integer> minMaxQualifiers = EncodedColumnsUtil.getMinMaxQualifiersFromScan(scan); Tuple result = useQualifierAsIndex ? new PositionBasedMultiKeyValueTuple() : new MultiKeyValueTuple();