Package org.apache.pig

Examples of org.apache.pig.PigServer.dumpSchema()


        pig.registerQuery("a = load 'thing';");
        pig.registerQuery("b = foreach a generate goodSchema1();");
        pig.registerQuery("c = foreach a generate goodSchema2();");
        pig.registerQuery("d = foreach a generate goodSchema3();");
        pig.dumpSchema("b");
        pig.dumpSchema("c");
        pig.dumpSchema("d");
    }
   
    @Test
    public void testEvalFuncGetVarArgToFunc() throws Exception {
View Full Code Here


        pig.registerQuery("b = foreach a generate goodSchema1();");
        pig.registerQuery("c = foreach a generate goodSchema2();");
        pig.registerQuery("d = foreach a generate goodSchema3();");
        pig.dumpSchema("b");
        pig.dumpSchema("c");
        pig.dumpSchema("d");
    }
   
    @Test
    public void testEvalFuncGetVarArgToFunc() throws Exception {
        String input = "udf_test_jira_3444.txt";
View Full Code Here

    public void testEnsureProperSchema2() throws Exception {
        PigServer pig = new PigServer(ExecType.LOCAL);
        pig.registerQuery("DEFINE badSchema org.apache.pig.test.TestUDF$MirrorSchema('a:int, b:int, c:int');");
        pig.registerQuery("a = load 'thing';");
        pig.registerQuery("b = foreach a generate badSchema();");
        pig.dumpSchema("b");
    }

    public static class MirrorSchema extends EvalFunc<Object> {
        private String schemaString;
        private Schema schema;
View Full Code Here

            + "l2 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int);"
            + "u = union onschema l1, l2;"
        ;
        Util.registerMultiLineQuery(pig, query);
        Schema expectedSch = Utils.getSchemaFromString("i: int, j: int");
        Schema sch = pig.dumpSchema("u");
        assertEquals("Checking expected schema",sch, expectedSch);
        Iterator<Tuple> it = pig.openIterator("u");
       
        List<Tuple> expectedRes =
            Util.getTuplesFromConstantTupleStrings(
View Full Code Here

            + "u = union onschema l1, l2;"
            + "fil = filter u by i == 5 and (x is null or x != 1);"
        ;
        Util.registerMultiLineQuery(pig, query);
       
        Schema sch = pig.dumpSchema("fil");
        Schema expectedSch = Utils.getSchemaFromString("i: int, x: int, j: int");
        assertEquals("Checking expected schema",sch, expectedSch);
       

        Iterator<Tuple> it = pig.openIterator("fil");
View Full Code Here

            + "lim = limit o 2;"
            + "fil = filter lim by i == 5 and y is null;"
        ;
        Util.registerMultiLineQuery(pig, query);       
       
        Schema sch = pig.dumpSchema("fil");
        Schema expectedSch = Utils.getSchemaFromString("i: int, x: int, y: int");
        assertEquals("Checking expected schema",sch, expectedSch);
       

        Iterator<Tuple> it = pig.openIterator("fil");
View Full Code Here

        + "f = foreach g generate flatten(l1); "
        + "l2 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int); ";

        String query = query_prefix + "u = union onschema f, l2; " ;
        Util.registerMultiLineQuery(pig, query);
        Schema sch = pig.dumpSchema("u");
        Schema expectedSch = Utils.getSchemaFromString("i: int, j: int");
        assertEquals("Checking expected schema",sch, expectedSch);
        Iterator<Tuple> it = pig.openIterator("u");

        List<Tuple> expectedRes =
View Full Code Here

        Util.checkQueryOutputsAfterSort(it, expectedRes);
       
        // now try reversing the order of relation
        query = query_prefix + "u = union onschema l2, f; " ;
        Util.registerMultiLineQuery(pig, query);
        sch = pig.dumpSchema("u");
        expectedSch = Utils.getSchemaFromString("i: int, j: int");
        assertEquals("Checking expected schema",sch, expectedSch);
        it = pig.openIterator("u");
        Util.checkQueryOutputsAfterSort(it, expectedRes);
View Full Code Here

        + "g2 = group l2 by i; "
        + "f2 = foreach g2 generate group as gkey, flatten(l2); "
        + "u = union onschema f1, f2; " ;
        Util.registerMultiLineQuery(pig, query);
       
        Schema sch = pig.dumpSchema("u");
        Schema expectedSch =
            Utils.getSchemaFromString("gkey: int, l1::i: int, l1::j: int, l2::i: int, l2::x: chararray");
        assertEquals("Checking expected schema",sch, expectedSch);

        Iterator<Tuple> it = pig.openIterator("u");
View Full Code Here

            + " cg2 = cogroup l2 by i, l1 by i; "
            + " f2 = foreach cg1 generate group as gkey, flatten(l2), flatten(l1); "
            + "u = union onschema f1, f2; " ;
        Util.registerMultiLineQuery(pig, query);
               
        Schema sch = pig.dumpSchema("u");
        Schema expectedSch =
            Utils.getSchemaFromString("gkey: int, l1::i: int, l1::j: int, l2::i: int, l2::x: chararray");
        assertEquals("Checking expected schema",sch, expectedSch);

        Iterator<Tuple> it = pig.openIterator("u");
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.