Package org.apache.pig.data

Examples of org.apache.pig.data.Tuple


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


        pigServer.registerQuery("C = foreach B generate c1 as c1 : chararray;");
       
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.toString().equals("(1)"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
        assertTrue(t.toString().equals("(2)"));

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

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

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

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

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

        pigServer.registerQuery("B = order A by a2;");
        pigServer.registerQuery("C = foreach B generate a2;");
        Iterator<Tuple> iter = pigServer.openIterator("C");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.toString().equals("(2)"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==1);
        assertTrue(t.toString().equals("(3)"));

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

        pigServer.registerQuery("D = cogroup A by a2, B by b2, C by c2;");
        pigServer.registerQuery("E = foreach D generate $1, $2;");
        Iterator<Tuple> iter = pigServer.openIterator("E");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.toString().equals("({(2,5,2)},{(2,5,2)})"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.toString().equals("({(1,2,3)},{(1,2,3)})"));

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

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

        results.add("(2,2)");
        results.add("(1,1)");
        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"}));
    }
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.