Examples of VIntWritable


Examples of org.apache.hadoop.io.VIntWritable

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

        TaggedTextItem k2=new TaggedTextItem(
                new Text("a")
                ,new VIntWritable(2)
        );

        assertEquals(0,k1.compareTo(k2));
        assertEquals(0,k2.compareTo(k1));
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

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

        TaggedTextItem k2=new TaggedTextItem(
                new Text("a")
                ,new VIntWritable(2)
        );

        assertEquals(-1,k1.compareTo(k2));
        assertEquals(1,k2.compareTo(k1));
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void roundTrips() throws IOException {
        TaggedTextItem k1=new TaggedTextItem(
                new Text("solvent")
                ,new VIntWritable(7777)
        );

        ByteArrayOutputStream byteStream=new ByteArrayOutputStream();
        DataOutput out=new DataOutputStream(byteStream);
        k1.write(out);
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void justOne() throws IOException, InterruptedException {
        that.reduce(
            new TaggedTextItem(
                    new Text("Canada Goose")
                    ,new VIntWritable(5)
            )
            ,new ArrayList<VIntWritable>() {{
                add(new VIntWritable(1));
            }}
            ,context);

        verify(context).write(
                new Text("Canada Goose")
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void justTwo() throws IOException, InterruptedException {
        that.reduce(
                new TaggedTextItem(
                        new Text("Canada Goose")
                        ,new VIntWritable(5)
                )
                ,new ArrayList<VIntWritable>() {{
                    add(new VIntWritable(2));
                }}
                ,context);

        verifyNoMoreInteractions(context);
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    @Test
    public void oneAndTwo() throws IOException, InterruptedException {
        that.reduce(
                new TaggedTextItem(
                        new Text("Canada Goose")
                        ,new VIntWritable(5)
                )
                ,new ArrayList<VIntWritable>() {{
                    add(new VIntWritable(1));
                    add(new VIntWritable(2));
                }}
                ,context);

        verifyNoMoreInteractions(context);
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

                "^"+JOINS.replace(".","[.]")+".*$";
        Map<String,VIntWritable> mapping= Maps.newHashMap();

        Map<String,String> targets=that.getValByRegex(prefixRegex);
        for(String keyNumber:targets.keySet()) {
            VIntWritable i=new VIntWritable(Integer.parseInt(lastSegment(keyNumber)));
            for(String path:commaSplitter.split(targets.get(keyNumber)))
                mapping.put(path,i);
        }

        return mapping;
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

                ,newTaggedValue(entry.getValue(),currentTag)
        );
    }

    static VIntWritable determineTag(Map<String,VIntWritable> mapping,String thePath) {
        VIntWritable currentTag=new VIntWritable(0);
        for(String aPrefix:mapping.keySet())
            if(thePath.startsWith(aPrefix))
                currentTag=mapping.get(aPrefix);

        return currentTag;
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

    public TaggedTextItem(Text key, VIntWritable tag) {
        super(key,tag);
    }

    public TaggedTextItem(Text key, int tag) {
        this(key,new VIntWritable(tag));
    }
View Full Code Here

Examples of org.apache.hadoop.io.VIntWritable

        if(key==null) {
            key=newT();
        }

        if(tag==null) {
            tag=new VIntWritable();
        }

        key.readFields(d);
        tag.readFields(d);
    }
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.