private Value reduceMultiValue( final Key key, final Iterator<Value> iter, final Value firstValue) { final String group; try { group = new String(key.getColumnFamilyData().getBackingArray(), CommonConstants.UTF_8); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage(), e); } ElementAggregator aggregator; Properties firstPropertySet; try { firstPropertySet = elementConverter.getPropertiesFromValue(group, firstValue); aggregator = schema.getElement(group).getAggregator(); aggregator.aggregate(firstPropertySet); while (iter.hasNext()) { aggregator.aggregate(elementConverter.getPropertiesFromValue(group, iter.next())); } } catch (final AccumuloElementConversionException e) { throw new IllegalArgumentException("Failed to get Properties from an accumulo value", e); } final Properties properties = new Properties(); aggregator.state(properties); try { return elementConverter.getValueFromProperties(group, properties); } catch (final AccumuloElementConversionException e) { throw new IllegalArgumentException("Failed to get Properties from an accumulo value", e); } }
@Override public Properties reduce(final String group, final Key key, final Iterator<Properties> iter) { if (!iter.hasNext()) { return new Properties(); } final Properties properties = iter.next(); if (!iter.hasNext()) { return properties; } final ElementAggregator aggregator = schema.getElement(group).getAggregator(); aggregator.aggregate(properties); while (iter.hasNext()) { aggregator.aggregate(iter.next()); } final Properties aggregatedProperties = new Properties(); aggregator.state(aggregatedProperties); return aggregatedProperties; }