private static float getProgressForRange( final GeoWaveRowRange range, final GeoWaveInputKey currentKey) { if (currentKey == null) { return 0f; } if ((range != null) && (range.getStartSortKey() != null) && (range.getEndSortKey() != null) && (currentKey.getGeoWaveKey() != null)) { // TODO GEOWAVE-1018 this doesn't account for partition keys at all // just look at the row progress return getProgressForRange( range.getStartSortKey(), range.getEndSortKey(), GeoWaveKey.getCompositeId(currentKey.getGeoWaveKey())); } // if we can't figure it out, then claim no progress return 0f; }
@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); } }