Package org.apache.pig.data

Examples of org.apache.pig.data.Tuple


        pigServer.registerQuery("B = group A by *;");
        pigServer.registerQuery("C = foreach B generate $0;");
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("(1,2,3)"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("(2,5,2)"));

        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here


        pigServer.registerQuery("C = join A by *, B by * using \"replicated\";");
        pigServer.registerQuery("D = foreach C generate $0;");
        Iterator<Tuple> iter = pigServer.openIterator("D");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        pigServer.registerQuery("B = foreach A generate *;");
        pigServer.registerQuery("C = foreach B generate $0;");
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("2"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $1, $2"}));
    }
View Full Code Here

        pigServer.registerQuery("B = foreach A generate StringSize(*);");
        pigServer.registerQuery("C = foreach B generate $0;");
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        Collection<String> results = new HashSet<String>();
        results.add("(2)");
        results.add("()");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(results.contains(t.toString()));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(results.contains(t.toString()));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $1, $2",
            "Columns pruned for B: $1, $2"}));
View Full Code Here

        pigServer.registerQuery("B = filter A by " + MyFilterFunc.class.getName() + "(*) ;");
        pigServer.registerQuery("C = foreach B generate $0;");
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("2"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        pigServer.registerQuery("B = foreach A generate a0, a1#'key1';");
       
        Iterator<Tuple> iter = pigServer.openIterator("B");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).equals(1));
        assertTrue(t.get(1).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).equals(2));
        assertTrue(t.get(1).toString().equals("2"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Map key required for A: $1->[key1]"}));
    }
View Full Code Here

        pigServer.registerQuery("C = foreach B generate $0#'key2', $1;");
       
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("4"));
        assertTrue(t.get(1).toString().equals("2"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $0",
                "Map key required for A: $1->[key2, key1]"}));
View Full Code Here

        pigServer.registerQuery("C = group B all;");
       
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("all"));
        assertTrue(t.get(1).toString().equals("{([key2#2,key1#1],1),([key2#4,key1#2],2)}"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $0"}));
    }
View Full Code Here

        pigServer.registerQuery("C = foreach B generate $0, $1#'key1';");
       
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("1"));
        assertTrue(t.get(1).toString().equals("1"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("2"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Map key required for A: $1->[key1]"}));
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.data.Tuple

Copyright © 2018 www.massapicom. 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.