@Override protected void reduceNativeValues( final GeoWaveInputKey key, final Iterable<Object> values, final ReduceContext<GeoWaveInputKey, ObjectWritable, GeoWaveInputKey, Object> context) throws IOException, InterruptedException { final Iterator<Object> valIt = values.iterator(); if (valIt.hasNext()) { key.setInternalAdapterId( // TODO this is a bit of a hack, but the // adapter is seemingly completely // transient and never actually // persisted - it seems unlikely that // the value for internal adapter ID // even matters, but if it does this is // the best effort InternalAdapterStoreImpl.getLazyInitialAdapterId(outputAdapter.getTypeName())); final SimpleFeature feature = getSimpleFeature(key, valIt.next()); context.write(key, feature); } }
@Override protected void mapNativeValue( final GeoWaveInputKey key, final Object value, final org.apache.hadoop.mapreduce.Mapper<GeoWaveInputKey, ObjectWritable, GeoWaveInputKey, ObjectWritable>.Context context) throws IOException, InterruptedException { @SuppressWarnings("unchecked") final AnalyticItemWrapper<T> wrapper = itemWrapperFactory.create((T) value); outputKey.setInternalAdapterId(key.getInternalAdapterId()); outputKey.setDataId( new ByteArray( StringUtils.stringToBinary(nestedGroupCentroidAssigner.getGroupForLevel(wrapper)))); outputKey.setGeoWaveKey(key.getGeoWaveKey()); context.write(outputKey, currentValue); }
@Override protected void mapNativeValue( final GeoWaveInputKey key, final Object value, final org.apache.hadoop.mapreduce.Mapper<GeoWaveInputKey, ObjectWritable, GeoWaveInputKey, ObjectWritable>.Context context) throws IOException, InterruptedException { @SuppressWarnings("unchecked") final double rank = samplingFunction.rank(sampleSize, (T) value); if (rank > 0.0000000001) { final AnalyticItemWrapper<Object> wrapper = itemWrapperFactory.create(value); outputKey.setDataId( new ByteArray( keyManager.putData( nestedGroupCentroidAssigner.getGroupForLevel(wrapper), 1.0 - rank, // sorts // in // ascending // order key.getDataId().getBytes()))); outputKey.setInternalAdapterId(key.getInternalAdapterId()); outputKey.setGeoWaveKey(key.getGeoWaveKey()); context.write(outputKey, currentValue); } }