Package org.apache.pig.data

Examples of org.apache.pig.data.Tuple


        pigServer.registerQuery("D = foreach B generate $1;");
       
        Iterator<Tuple> iter = pigServer.openIterator("D");
       
        assertTrue(iter.hasNext());
        Tuple 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: $2"}));
    }
View Full Code Here


        pigServer.registerQuery("D = foreach B generate $1;");
       
        Iterator<Tuple> iter = pigServer.openIterator("D");
       
        assertTrue(iter.hasNext());
        Tuple 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: $2"}));
    }
View Full Code Here

        pigServer.registerQuery("A = load '"+ Util.generateURI(tmpFile1.toString(), pigServer.getPigContext()) + "';");
        pigServer.registerQuery("B = foreach A generate $1, $2;");
        Iterator<Tuple> iter = pigServer.openIterator("B");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("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"));
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

        pigServer.registerQuery("A = load '"+ Util.generateURI(tmpFile1.toString(), pigServer.getPigContext()) + "';");
        pigServer.registerQuery("B = foreach A generate $1, 'aoeuaoeu';");
        Iterator<Tuple> iter = pigServer.openIterator("B");
       
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("2"));
        assertTrue(t.get(1).toString().equals("aoeuaoeu"));
       
        assertTrue(iter.hasNext());
        t = iter.next();
       
        assertTrue(t.size()==2);
        assertTrue(t.get(0).toString().equals("5"));
        assertTrue(t.get(1).toString().equals("aoeuaoeu"));
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

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

        pigServer.registerQuery("B = group A all;");
        pigServer.registerQuery("C = foreach B generate $1;");
        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),(2,5,2)}"));
       
        assertFalse(iter.hasNext());
       
        assertTrue(emptyLogFileMessage());
    }
View Full Code Here

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

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

        pigServer.registerQuery("B = order A by $0;");
        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 = order 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"));
       
        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

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.