use of org.apache.hadoop.io.VIntWritable in project SQLWindowing by hbutani.
the class ByteBasedSortedMapTest method testGeti.
@Test
public void testGeti() throws Exception {
int i = 0;
for (i = table.length - 1; i >= 0; i--) {
bm.put(new Text(table[i]), new VIntWritable(i));
}
Assert.assertEquals(table.length, bm.size());
for (i = 0; i < table.length; i++) {
bm.getKey(i, wObj);
Assert.assertEquals(table[i], wObj.toString());
bm.getValue(wObj, value);
Assert.assertEquals(value.get(), i);
}
}
use of org.apache.hadoop.io.VIntWritable in project SQLWindowing by hbutani.
the class ByteBasedSortedMapTest method testKeyItr.
@Test
public void testKeyItr() throws Exception {
int i = 0;
for (i = table.length - 1; i >= 0; i--) {
bm.put(new Text(table[i]), new VIntWritable(i));
}
Assert.assertEquals(table.length, bm.size());
Iterator<Writable> it = bm.keyIterator(wObj);
i = 0;
while (it.hasNext()) {
Writable we = it.next();
Assert.assertEquals(table[i], we.toString());
bm.getValue(we, value);
Assert.assertEquals(value.get(), i);
i++;
}
}
use of org.apache.hadoop.io.VIntWritable in project SQLWindowing by hbutani.
the class ByteBasedSortedMapTest method testMultiplePut.
@Test
public void testMultiplePut() throws Exception {
int i = 0;
for (i = table.length - 1; i >= 0; i--) {
bm.put(new Text(table[i]), new VIntWritable(i));
}
for (i = table.length - 1; i >= 0; i--) {
bm.put(new Text(table[i]), new VIntWritable(i));
}
Assert.assertEquals(table.length, bm.size());
for (i = 0; i < table.length; i++) {
bm.getKey(i, wObj);
Assert.assertEquals(table[i], wObj.toString());
bm.getValue(wObj, value);
Assert.assertEquals(value.get(), i);
}
}
use of org.apache.hadoop.io.VIntWritable in project SQLWindowing by hbutani.
the class PartitionedByteBasedSortedMapTest method testKeyItr.
@Test
public void testKeyItr() throws Exception {
int i = 0;
for (i = table.length - 1; i >= 0; i--) {
bm.put(new Text(table[i]), new VIntWritable(i));
}
Assert.assertEquals(table.length, bm.size());
Iterator<Writable> it = bm.keyIterator(wObj);
i = 0;
while (it.hasNext()) {
Writable we = it.next();
Assert.assertEquals(table[i], we.toString());
bm.getValue(we, value);
Assert.assertEquals(value.get(), i);
i++;
}
}
use of org.apache.hadoop.io.VIntWritable in project SQLWindowing by hbutani.
the class PartitionedByteBasedSortedMapTest method testRandomPut.
@Test
public void testRandomPut() throws Exception {
int i = 0;
for (i = 0; i < table.length; i++) {
int j = (i + 13) % table.length;
bm.put(new Text(table[j]), new VIntWritable(j));
}
Assert.assertEquals(table.length, bm.size());
for (i = 0; i < table.length; i++) {
bm.getKey(i, wObj);
Assert.assertEquals(table[i], wObj.toString());
bm.getValue(wObj, value);
Assert.assertEquals(value.get(), i);
}
}
Aggregations