Examples of openIterator()


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

        secondFieldContents[1] = Util.createTuple(Util.toDataByteArrays(new String[] {"1", "200", "300"}));
        DataBag secondField = Util.createBag(secondFieldContents);
        expectedResult.append(secondField);
        DataBag thirdField = Util.createBag(new Tuple[]{Util.createTuple(Util.toDataByteArrays(new String[]{"1", "20", "30"}))});
        expectedResult.append(thirdField);
        Iterator<Tuple> it = pig.openIterator("e");
        assertEquals(expectedResult, it.next());
        assertFalse(it.hasNext());
    }
   
    // Test schema merge in union when one of the fields is a bag
View Full Code Here

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

            "b = load 'input2.txt';" +
            "c = foreach a generate 1, {(1, 'str1')};" +
            "d = foreach b generate 2, {(2, 'str2')};" +
            "e = union c,d;" +
            "");
        Iterator<Tuple> it = pig.openIterator("e");
        Object[] expected = new Object[] { Util.getPigConstant("(1, {(1, 'str1')})"),
                Util.getPigConstant("(2, {(2, 'str2')})")};
        Object[] results = new Object[2];
        int i = 0;
        while(it.hasNext()) {
View Full Code Here

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

        assertEquals(100, cis.read(new byte[100]));
        cis.close();
       
        pig.registerQuery("B = load '" + out.getAbsolutePath() + "';");
       
        Iterator<Tuple> i = pig.openIterator("B");
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        while (i.hasNext()) {
            Integer val = DataType.toInteger(i.next().get(0));
            map.put(val, val);           
        }
View Full Code Here

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

        assertEquals(100, cis.read(new byte[100]));
        cis.close();
       
        pig.registerQuery("B = load '" + out.getAbsolutePath() + "';");
       
        Iterator<Tuple> i = pig.openIterator("B");
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        while (i.hasNext()) {
            Integer val = DataType.toInteger(i.next().get(0));
            map.put(val, val);           
        }
View Full Code Here

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

            // pig script to read uncompressed input
            String script = "a = load '" + unCompressedInputFileName +"';";
            PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster
                    .getProperties());
            pig.registerQuery(script);
            Iterator<Tuple> it1 = pig.openIterator("a");
           
            // pig script to read compressed input
            script = "a = load '" + compressedInputFileName +"';";
            pig.registerQuery(script);
            Iterator<Tuple> it2 = pig.openIterator("a");
View Full Code Here

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

            Iterator<Tuple> it1 = pig.openIterator("a");
           
            // pig script to read compressed input
            script = "a = load '" + compressedInputFileName +"';";
            pig.registerQuery(script);
            Iterator<Tuple> it2 = pig.openIterator("a");
           
            while(it1.hasNext()) {
                Tuple t1 = it1.next();
                Tuple t2 = it2.next();
                Assert.assertEquals(t1, t2);
View Full Code Here

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

        {
            pigServer.getPigContext().getProperties().setProperty(
                    MRCompiler.FILE_CONCATENATION_THRESHOLD, String.valueOf(FILE_MERGE_THRESHOLD));
           
            pigServer.registerQuery("D= foreach A generate x / C.count, C.max - y;");
            Iterator<Tuple> iter = pigServer.openIterator("D");
           
            while(iter.hasNext()) {
                dbfrj.add(iter.next());
            }
           
View Full Code Here

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

        {
            pigServer.getPigContext().getProperties().setProperty(
                    "pig.noSplitCombination", "true");
           
            pigServer.registerQuery("D= foreach A generate x / C.count, C.max - y;");
            Iterator<Tuple> iter = pigServer.openIterator("D");
           
            while(iter.hasNext()) {
                dbshj.add(iter.next());
            }
           
View Full Code Here

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

        {
            pigServer.getPigContext().getProperties().setProperty(
                    MRCompiler.FILE_CONCATENATION_THRESHOLD, String.valueOf(MIN_FILE_MERGE_THRESHOLD));
           
            pigServer.registerQuery("D = foreach A generate x / C.x, y + C.y;");
            Iterator<Tuple> iter = pigServer.openIterator("D");
           
            while(iter.hasNext()) {
                dbfrj.add(iter.next());
            }
           
View Full Code Here

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

        {
            pigServer.getPigContext().getProperties().setProperty(
                    "pig.noSplitCombination", "true");
           
            pigServer.registerQuery("D = foreach A generate x / C.x, y + C.y;");
            Iterator<Tuple> iter = pigServer.openIterator("D");
           
            while(iter.hasNext()) {
                dbshj.add(iter.next());
            }
           
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.