Package org.apache.pig.data

Examples of org.apache.pig.data.SingleTupleBag


            // appropriately from the input bag
            Tuple tuple = inpBag.iterator().next();
            Tuple tmpTuple = tupleFactory.newTuple(columns.size());
            for (int i = 0; i < columns.size(); i++)
                tmpTuple.set(i, tuple.get(columns.get(i)));
            outBag = new SingleTupleBag(tmpTuple);
        } else {
            outBag = bagFactory.newDefaultBag();
            for (Tuple tuple : inpBag) {
                Tuple tmpTuple = tupleFactory.newTuple(columns.size());
                for (int i = 0; i < columns.size(); i++)
View Full Code Here


            // the input has  a single field which is a tuple
            // representing the data we want to distinct.
            // unwrap, put in a bag and send down
            try {
                Tuple single = (Tuple)input.get(0);
                DataBag bag = single == null ? createDataBag() : new SingleTupleBag(single);
                return tupleFactory.newTuple(bag);
            } catch (ExecException e) {
                throw e;
            }
        }
View Full Code Here

        Tuple output = mTupleFactory.newTuple(2);
        output.set(0, key);
        // put the value in a bag so that the initial
        // version of the Algebraics will get a bag as
        // they would expect.
        DataBag bg = new SingleTupleBag(value);
        output.set(1, bg);
        return output;
    }
View Full Code Here

            // the input has  a single field which is a tuple
            // representing the data we want to distinct.
            // unwrap, put in a bag and send down
            try {
                Tuple single = (Tuple)input.get(0);
                DataBag bag = single == null ? createDataBag() : new SingleTupleBag(single);
                return tupleFactory.newTuple(bag);
            } catch (ExecException e) {
                throw e;
            }
        }
View Full Code Here

                if(!isProjectToEnd){
                    ArrayList<Object> objList = new ArrayList<Object>(columns.size());
                    for (int col : columns) {
                        addColumn(objList, tuple, col);
                    }
                    outBag = new SingleTupleBag( tupleFactory.newTupleNoCopy(objList) );
                }else {
                    Tuple tmpTuple = getRangeTuple(tuple);
                    outBag = new SingleTupleBag(tmpTuple);
                }
            } else {
                outBag = bagFactory.newDefaultBag();
                for (Tuple tuple : inpBag) {
                    if(!isProjectToEnd){
View Full Code Here

    public void testSingleTupleBagAcess() throws Exception {
        Tuple inputTuple = new DefaultTuple();
        inputTuple.append("a");
        inputTuple.append("b");

        SingleTupleBag bg = new SingleTupleBag(inputTuple);
        Iterator<Tuple> it = bg.iterator();
        assertEquals(inputTuple, it.next());
        assertFalse(it.hasNext());
    }
View Full Code Here

            // appropriately from the input bag
            Tuple tuple = inpBag.iterator().next();
            Tuple tmpTuple = tupleFactory.newTuple(columns.size());
            for (int i = 0; i < columns.size(); i++)
                tmpTuple.set(i, tuple.get(columns.get(i)));
            outBag = new SingleTupleBag(tmpTuple);
        } else {
            outBag = BagFactory.getInstance().newDefaultBag();
            for (Tuple tuple : inpBag) {
                Tuple tmpTuple = tupleFactory.newTuple(columns.size());
                for (int i = 0; i < columns.size(); i++)
View Full Code Here

        public Tuple exec(Tuple input) throws IOException {
            // the input has  a single field which is a tuple
            // representing the data we want to distinct.
            // unwrap, put in a bag and send down
            try {
                DataBag bag = new SingleTupleBag((Tuple)input.get(0));
                return tupleFactory.newTuple(bag);
            } catch (ExecException e) {
                throw e;
            }
        }
View Full Code Here

    public void testSingleTupleBagAcess() throws Exception {
        Tuple inputTuple = new DefaultTuple();
        inputTuple.append("a");
        inputTuple.append("b");

        SingleTupleBag bg = new SingleTupleBag(inputTuple);
        Iterator<Tuple> it = bg.iterator();
        assertEquals(inputTuple, it.next());
        assertFalse(it.hasNext());
    }
View Full Code Here

                if(!isProjectToEnd){
                    ArrayList<Object> objList = new ArrayList<Object>(columns.size());
                    for (int col : columns) {
                        addColumn(objList, tuple, col);
                    }
                    outBag = new SingleTupleBag( tupleFactory.newTupleNoCopy(objList) );
                }else {
                    Tuple tmpTuple = getRangeTuple(tuple);
                    outBag = new SingleTupleBag(tmpTuple);
                }
            } else {
                outBag = bagFactory.newDefaultBag();
                for (Tuple tuple : inpBag) {
                    if(!isProjectToEnd){
View Full Code Here

TOP

Related Classes of org.apache.pig.data.SingleTupleBag

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.