Package org.apache.pig.data

Examples of org.apache.pig.data.Tuple


        results.add("(2)");
        results.add("(1)");
        results.add("(2)");

        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()));

        assertTrue(iter.hasNext());
        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(emptyLogFileMessage());
    }
View Full Code Here


        pigServer.registerQuery("B = group A by (a0, a1);");
        pigServer.registerQuery("C = foreach B generate flatten(group);");
        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("2"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("5"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $2"}));
    }
View Full Code Here

        pigServer.registerQuery("B = distinct A;");
        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"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        pigServer.registerQuery("B = stream A through `" + simpleEchoStreamingCommand + "`;");
        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 ($1 == '2'? $2 : $3);");
        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("3"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.get(0).toString().equals("5"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $0"}));
    }
View Full Code Here

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

        pigServer.registerQuery("C = cogroup A by ($1), B by ($1);");
        pigServer.registerQuery("D = foreach C {B = order B by $0;generate FLATTEN(A), B.($1);};");
        Iterator<Tuple> iter = pigServer.openIterator("D");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==4);
        assertTrue(t.get(0).toString().equals("1"));
        assertTrue(t.get(1).toString().equals("2"));
        assertTrue(t.get(2).toString().equals("3"));
        assertTrue(t.get(3).toString().equals("{(2)}"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==4);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("5"));
        assertTrue(t.get(2).toString().equals("2"));
        assertTrue(t.get(3).toString().equals("{}"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        results.add("(2,1)");
        results.add("(1,2)");
        results.add("(2,2)");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(results.contains(t.toString()));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(results.contains(t.toString()));

        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(results.contains(t.toString()));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(results.contains(t.toString()));

        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $1, $2",
            "Columns pruned for B: $1"}));
View Full Code Here

       
        Collection<String> results = new HashSet<String>();
        results.add("(1,3)");
        results.add("(2,2)");
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==2);
        results.contains(t.toString());
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        results.contains(t.toString());

        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        results.contains(t.toString());
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        results.contains(t.toString());

        assertFalse(iter.hasNext());
       
        assertTrue(checkLogFileMessage(new String[]{"Columns pruned for A: $1",
            "Columns pruned for B: $1"}));
View Full Code Here

        pigServer.registerQuery("C = join A by $0, B by $0 using \"replicated\";");
        pigServer.registerQuery("D = foreach C generate $0, $3;");
        Iterator<Tuple> iter = pigServer.openIterator("D");
       
        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[]{"Columns pruned for A: $1, $2",
            "Columns pruned for B: $1"}));
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.