Examples of VIntWritable


Examples of org.apache.hadoop.io.VIntWritable

    Writable[] vectorValues = new Writable[] {
      new Text("test1"), new Text("test2"), new Text("test3")
    };
    ArrayWritable vector = new ArrayWritable(Text.class, vectorValues);
    MapWritable map = new MapWritable();
    map.put(new Text("one"), new VIntWritable(1));
    map.put(new Text("two"), new VLongWritable(2));
    Writable[] writables = new Writable[] {
      new BytesWritable(new byte[] { 1, 2, 3, 4 }),
      new ByteWritable((byte) 123), new BooleanWritable(true),
      new VIntWritable(12345), new VLongWritable(123456789L),
      new FloatWritable((float) 1.2), new DoubleWritable(1.234),
      new Text("random string"),
      new ObjectWritable("test")
    };
    TypedBytesWritable tbw = new TypedBytesWritable();
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    }

    @Test
    public void splitOrdinaryStatement() {
        Text input=new Text("<http://example.com/bo_peep>\t<http://unknown.org/predicate>\t<http://yahoo.com/yyyyy/>\t.");
        Map.Entry<Text,Text> output=mapper.splitValue(input,new VIntWritable(16));
        assertEquals("<http://yahoo.com/yyyyy/>",output.getKey().toString());
        assertEquals(input,output.getValue());
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    }

    @Test
    public void splitSameAsStatement() {
        Text input=new Text("<http://aristotle.org/Alcohol>\t<http://www.w3.org/2002/07/owl#sameAs>\t<http://aristotle.org/EtOH>\t.");
        Map.Entry<Text,Text> output=mapper.splitValue(input,new VIntWritable(1));
        assertEquals("<http://aristotle.org/Alcohol>",output.getKey().toString());
        assertEquals(input,output.getValue());
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

        );
    }

    private HashMap<String, VIntWritable> getExample() {
        return new HashMap<String,VIntWritable>() {{
            put("your",new VIntWritable(1));
            put("brain",new VIntWritable(1));
            put("on",new VIntWritable(1));
            put("drugs",new VIntWritable(1));
            put("very",new VIntWritable(2));
            put("last",new VIntWritable(2));
            put("factory",new VIntWritable(2));
            put("belong",new VIntWritable(3));
        }};
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

                )
        );
        m.map(new LongWritable(666),new Text("Ganbaru!"),c2);
        verify(c2).getInputSplit();
        verify(c2).write(
                new TaggedTextItem(new Text("Ganbaru!"),new VIntWritable(75)), new VIntWritable(75)
        );
        verifyNoMoreInteractions(c2);

        Mapper.Context c3=mock(Mapper.Context.class);
        stub(c3.getInputSplit()).toReturn(
                new FileSplit(
                        new Path("s3n://basekb-now/2013-11-10/sieved/description/description-m-00099.nt.gz")
                        ,0
                        ,0
                        ,null
                )
        );
        m.map(new LongWritable(667),new Text("He was some kind of recording genius"),c3);
        verify(c3).getInputSplit();
        verify(c3).write(
                new TaggedTextItem(new Text("He was some kind of recording genius"),new VIntWritable(0)), new VIntWritable(0)
        );
        verifyNoMoreInteractions(c3);

        Mapper.Context c4=mock(Mapper.Context.class);
        stub(c4.getInputSplit()).toReturn(
                new FileSplit(
                        new Path("s3n://basekb-now/2013-11-10/sieved/a/a-m-21345.nt.gz")
                        ,0
                        ,0
                        ,null
                )
        );

        m.map(new LongWritable(668),new Text("Nothing comes easy"),c4);
        verify(c4).getInputSplit();
        verify(c4).write(
                new TaggedTextItem(new Text("Nothing comes easy"),new VIntWritable(23)), new VIntWritable(23)
        );
        verifyNoMoreInteractions(c4);
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void dualArgConstructorSetsValues() {
        TaggedTextItem that=new TaggedTextItem(
            new Text("Doctor Funkenstein")
            ,new VIntWritable(33550336)
        );

        assertEquals("Doctor Funkenstein",that.getKey().toString());
        assertEquals(33550336,that.getTag().get());
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void equalIfTagsAreEqual() {
        TaggedTextItem k1=new TaggedTextItem(
                new Text("Doctor Funkenstein")
                ,new VIntWritable(33550336)
        );

        TaggedTextItem k2=new TaggedTextItem(
                new Text("Doctor Funkenstein")
                ,new VIntWritable(702)
        );

        assertTrue(k1.equals(k2));
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void unequalIfTagsAreUnequal() {
        TaggedTextItem k1=new TaggedTextItem(
                new Text("Doctor Funkenstein")
                ,new VIntWritable(33550336)
        );

        TaggedTextItem k2=new TaggedTextItem(
                new Text("Sir Nose D'void of Funk")
                ,new VIntWritable(702)
        );

        assertFalse(k1.equals(k2));
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void hashEqualsHashOfKey() {
        TaggedTextItem k1=new TaggedTextItem(
                new Text("Doctor Funkenstein")
                ,new VIntWritable(33550336)
        );

        assertEquals(
                new Text("Doctor Funkenstein").hashCode()
                ,k1.hashCode()
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void sortsByOrderOfKeys() {
        TaggedTextItem k1=new TaggedTextItem(
                new Text("a")
                ,new VIntWritable(2)
        );

        TaggedTextItem k2=new TaggedTextItem(
                new Text("b")
                ,new VIntWritable(1)
        );

        assertEquals(-1,k1.compareTo(k2));
        assertEquals(1,k2.compareTo(k1));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.