Examples of openIterator()


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

        // will do the value verification later
        assertEquals(-1, cis.read(new byte[100]));
        cis.close();
       
        pig.registerQuery("B = load '" + out.getAbsolutePath() + "';");
        pig.openIterator("B");
       
        in.delete();
        out.delete();
       
    }
View Full Code Here

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

        }
        assertEquals(true, numPartFiles > 0);
       
        // verify record count to verify we read bzip data correctly
        Util.registerMultiLineQuery(pig, script);
        Iterator<Tuple> it = pig.openIterator("c");
        Long result = (Long) it.next().get(0);
        assertEquals(expectedCount, result);
       
    }
   
View Full Code Here

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

  public void testUDFReturnMap_LocalMode() {
    try {
      PigServer pig = new PigServer(ExecType.LOCAL);
      pig.registerScript(TempScriptFile.getAbsolutePath());

      Iterator<Tuple> iterator = pig.openIterator("B");
      int index = 0;
      while (iterator.hasNext()) {
        Tuple tuple = iterator.next();
        index++;
        Map<Object, Object> result = (Map<Object, Object>) tuple.get(0);
View Full Code Here

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

          .getProperties());
      pig.registerQuery("A = LOAD 'a.txt';");
      pig
          .registerQuery("B = FOREACH A GENERATE org.apache.pig.test.utils.MyUDFReturnMap();");

      Iterator<Tuple> iterator = pig.openIterator("B");
      int index = 0;
      while (iterator.hasNext()) {
        Tuple tuple = iterator.next();
        index++;
        Map<Object, Object> result = (Map<Object, Object>) tuple.get(0);
View Full Code Here

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

  public void testUDFWithoutParameter() {
    try {
      PigServer pig = new PigServer(ExecType.LOCAL);
      pig.registerScript(TempScriptFile.getAbsolutePath());
     
      Iterator<Tuple> iterator=pig.openIterator("B");
      int index=0;
      while(iterator.hasNext()){
        Tuple tuple=iterator.next();
        index++;
        int result=(Integer)tuple.get(0);
View Full Code Here

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

        File f = Util.createInputFile("tmp", "", new String[] {"a", "b", "c"});
        pig.registerQuery("a = load '"
                + Util.generateURI(f.toString(), pig.getPigContext()) + "';");
        // -1 is modeled as POnegative with Constant(1)
        pig.registerQuery("b = foreach a generate SIZE(-1);");
        Iterator<Tuple> it = pig.openIterator("b");
        int i = 0;
        while(it.hasNext()) {
            assertEquals(1L, it.next().get(0));
            i++;
        }
View Full Code Here

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

           
            Util.copyFromLocalToCluster(cluster, INPUT_FILE, INPUT_FILE);
           
            pigServer.registerQuery("a = load '" + INPUT_FILE + "';");
           
            Iterator<Tuple> iter = pigServer.openIterator("a");
            int counter = 0;
            while (iter.hasNext()){
                assertEquals(expected[counter++].toString(), iter.next().toString());
            }
           
View Full Code Here

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

                new String[] {"1\t2\t3", "4", "5\t6\t7"});
        PigServer ps = new PigServer(ExecType.LOCAL);
        String script = "a = load '" + inputFileName + "' as (i:int, j:int, k:int);" +
            "b = foreach a generate j, k;";
        Util.registerMultiLineQuery(ps, script);
        Iterator<Tuple> it = ps.openIterator("b");
        assertEquals(Util.createTuple(new Integer[] { 2, 3}), it.next());
        assertEquals(Util.createTuple(new Integer[] { null, null}), it.next());
        assertEquals(Util.createTuple(new Integer[] { 6, 7}), it.next());
        assertFalse(it.hasNext());
               
View Full Code Here

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

        ;
        Util.registerMultiLineQuery(pig, query);
        Schema expectedSch = Util.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(
                    new String[] {
                            "(1,2)",
View Full Code Here

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

        Schema sch = pig.dumpSchema("fil");
        Schema expectedSch = Util.getSchemaFromString("i: int, x: int, j: int");
        assertEquals("Checking expected schema",sch, expectedSch);
       

        Iterator<Tuple> it = pig.openIterator("fil");
        List<Tuple> expectedRes =
            Util.getTuplesFromConstantTupleStrings(
                    new String[] {
                            "(5,null,3)",
                            "(5,3,null)"
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.