Search in sources :

Example 1 with PartitionDataWritable

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;
}
Also used : AdapterWithObjectWritable(org.locationtech.geowave.analytic.AdapterWithObjectWritable) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PartitionDataWritable(org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable) Pair(org.apache.hadoop.mrunit.types.Pair)

Example 2 with PartitionDataWritable

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);
}
Also used : PartitionData(org.locationtech.geowave.analytic.partitioner.Partitioner.PartitionData) DataInputByteBuffer(org.apache.hadoop.io.DataInputByteBuffer) DataOutputBuffer(org.apache.hadoop.io.DataOutputBuffer) ByteArray(org.locationtech.geowave.core.index.ByteArray) PartitionDataWritable(org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable) Test(org.junit.Test)

Example 3 with PartitionDataWritable

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;
}
Also used : AdapterWithObjectWritable(org.locationtech.geowave.analytic.AdapterWithObjectWritable) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PartitionDataWritable(org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable) Pair(org.apache.hadoop.mrunit.types.Pair)

Aggregations

PartitionDataWritable (org.locationtech.geowave.analytic.mapreduce.nn.NNMapReduce.PartitionDataWritable)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Pair (org.apache.hadoop.mrunit.types.Pair)2 AdapterWithObjectWritable (org.locationtech.geowave.analytic.AdapterWithObjectWritable)2 DataInputByteBuffer (org.apache.hadoop.io.DataInputByteBuffer)1 DataOutputBuffer (org.apache.hadoop.io.DataOutputBuffer)1 Test (org.junit.Test)1 PartitionData (org.locationtech.geowave.analytic.partitioner.Partitioner.PartitionData)1 ByteArray (org.locationtech.geowave.core.index.ByteArray)1