use of org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable in project geowave by locationtech.
the class DBScanMapReduceTest method getListFor.
private List<AdapterWithObjectWritable> getListFor(final PartitionDataWritable pd, final List<Pair<PartitionDataWritable, List<AdapterWithObjectWritable>>> reducerInputSet) {
for (final Pair<PartitionDataWritable, List<AdapterWithObjectWritable>> pair : reducerInputSet) {
if (pair.getFirst().compareTo(pd) == 0) {
return pair.getSecond();
}
}
final List<AdapterWithObjectWritable> newPairList = new ArrayList<>();
reducerInputSet.add(new Pair(pd, newPairList));
return newPairList;
}
use of org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable in project geowave by locationtech.
the class NNMapReduceTest method testWritable.
@Test
public void testWritable() throws IOException {
final PartitionDataWritable writable1 = new PartitionDataWritable();
final PartitionDataWritable writable2 = new PartitionDataWritable();
writable1.setPartitionData(new PartitionData(new ByteArray(new byte[] {}), new ByteArray("abc"), true));
writable2.setPartitionData(new PartitionData(new ByteArray(new byte[] {}), new ByteArray("abc"), false));
assertTrue(writable1.compareTo(writable2) == 0);
writable2.setPartitionData(new PartitionData(new ByteArray(new byte[] {}), new ByteArray("abd"), false));
assertTrue(writable1.compareTo(writable2) < 0);
writable2.setPartitionData(new PartitionData(new ByteArray(new byte[] {}), new ByteArray("abd"), true));
assertTrue(writable1.compareTo(writable2) < 0);
final DataOutputBuffer output = new DataOutputBuffer();
writable1.write(output);
output.flush();
final DataInputByteBuffer input = new DataInputByteBuffer();
input.reset(ByteBuffer.wrap(output.getData()));
writable2.readFields(input);
assertTrue(writable1.compareTo(writable2) == 0);
}
use of org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable in project geowave by locationtech.
the class NNMapReduceTest method getListFor.
private List<AdapterWithObjectWritable> getListFor(final PartitionDataWritable pd, final List<Pair<PartitionDataWritable, List<AdapterWithObjectWritable>>> reducerInputSet) {
for (final Pair<PartitionDataWritable, List<AdapterWithObjectWritable>> pair : reducerInputSet) {
if (pair.getFirst().compareTo(pd) == 0) {
return pair.getSecond();
}
}
final List<AdapterWithObjectWritable> newPairList = new ArrayList<>();
reducerInputSet.add(new Pair(pd, newPairList));
return newPairList;
}
Aggregations