Search in sources :

Example 11 with VIntWritable

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);
    }
}
Also used : VIntWritable(org.apache.hadoop.io.VIntWritable) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 12 with VIntWritable

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++;
    }
}
Also used : VIntWritable(org.apache.hadoop.io.VIntWritable) Writable(org.apache.hadoop.io.Writable) VIntWritable(org.apache.hadoop.io.VIntWritable) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 13 with VIntWritable

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);
    }
}
Also used : VIntWritable(org.apache.hadoop.io.VIntWritable) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 14 with VIntWritable

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++;
    }
}
Also used : VIntWritable(org.apache.hadoop.io.VIntWritable) Writable(org.apache.hadoop.io.Writable) VIntWritable(org.apache.hadoop.io.VIntWritable) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 15 with VIntWritable

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);
    }
}
Also used : VIntWritable(org.apache.hadoop.io.VIntWritable) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Aggregations

VIntWritable (org.apache.hadoop.io.VIntWritable)19 Text (org.apache.hadoop.io.Text)16 Test (org.junit.Test)14 ByteBasedSortedMapTest (com.sap.hadoop.ds.sortedmap.ByteBasedSortedMapTest)4 File (java.io.File)4 Writable (org.apache.hadoop.io.Writable)3 Before (org.junit.Before)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DateWritable (org.apache.hadoop.hive.serde2.io.DateWritable)2 HiveCharWritable (org.apache.hadoop.hive.serde2.io.HiveCharWritable)2 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)2 HiveVarcharWritable (org.apache.hadoop.hive.serde2.io.HiveVarcharWritable)2 TimestampWritable (org.apache.hadoop.hive.serde2.io.TimestampWritable)2 VLongWritable (org.apache.hadoop.io.VLongWritable)2 Date (java.sql.Date)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1