Package org.apache.pig.impl.io

Examples of org.apache.pig.impl.io.NullableTuple


           

            Byte index = (Byte)tuple.get(0);
            PigNullableWritable key =
                HDataType.getWritableComparableTypes(keyTuple, DataType.TUPLE);
            NullableTuple val = new NullableTuple((Tuple)tuple.get(2));
            // Both the key and the value need the index.  The key needs it so
            // that it can be sorted on the index in addition to the key
            // value.  The value needs it so that POPackage can properly
            // assign the tuple to its slot in the projection.
            key.setIndex(index);
            val.setIndex(index);
            oc.collect(key, val);
        }
View Full Code Here


      NullablePartitionWritable wrappedKey = new NullablePartitionWritable(key);
      //key.setIndex(index);
      //NullableTuple wrappedKey = new NullableTuple((Tuple)tuple);

      NullableTuple val = new NullableTuple((Tuple)tuple.get(tupleValIdx));
            // Both the key and the value need the index.  The key needs it so
            // that it can be sorted on the index in addition to the key
            // value.  The value needs it so that POPackage can properly
            // assign the tuple to its slot in the projection.
            wrappedKey.setIndex(index);
      // set the partition
      wrappedKey.setPartition(partitionIndex);
      val.setIndex(index);
            oc.collect(wrappedKey, val);
            //oc.collect(key, val);
        }
View Full Code Here

                        if(redRes.returnStatus==POStatus.STATUS_OK){
                            Tuple tuple = (Tuple)redRes.result;
                            Byte index = (Byte)tuple.get(0);
                            PigNullableWritable outKey =
                                HDataType.getWritableComparableTypes(tuple.get(1), this.keyType);
                            NullableTuple val =
                                new NullableTuple((Tuple)tuple.get(2));
                            // Both the key and the value need the index.  The key needs it so
                            // that it can be sorted on the index in addition to the key
                            // value.  The value needs it so that POPackage can properly
                            // assign the tuple to its slot in the projection.
                            outKey.setIndex(index);
                            val.setIndex(index);
                            oc.collect(outKey, val);
                            continue;
                        }
                       
                        if(redRes.returnStatus==POStatus.STATUS_EOP)
View Full Code Here

        try {
            // user comparators work with tuples - so if user comparator
            // is being used OR if there are more than 1 sort cols, use
            // NullableTuple
            if ("true".equals(job.get("pig.usercomparator")) || t.size() > 1) {
                return new NullableTuple(t);
            } else {
                Object o = t.get(0);
                String kts = job.get("pig.reduce.key.type");
                if (kts == null) {
                    throw new RuntimeException("Didn't get reduce key type "
View Full Code Here

        DataBag db2 = GenRandomData.genRandSmallTupDataBag(r, 10, 100);
        List<NullableTuple> db = new ArrayList<NullableTuple>(200);
        Iterator db1Iter = db1.iterator();
        if(!inner[0]){
            while (db1Iter.hasNext()) {
                NullableTuple it = new NullableTuple((Tuple)db1Iter.next());
                it.setIndex((byte)0);
                db.add(it);
            }
        }
        Iterator db2Iter = db2.iterator();
        while (db2Iter.hasNext()) {
            NullableTuple it = new NullableTuple((Tuple) db2Iter.next());
            it.setIndex((byte)1);
            db.add(it);
        }
        //ITIterator iti = new TestPackage.ITIterator(db.iterator());
        POPackage pop = new POPackage(new OperatorKey("", r.nextLong()));
        pop.setNumInps(2);
View Full Code Here

           
            //For each indexed tup in the inp, sort them
            //into their corresponding bags based
            //on the index
            while (tupIter.hasNext()) {
                NullableTuple ntup = tupIter.next();
                int index = ntup.getIndex();
                Tuple copy = getValueTuple(ntup, index)
               
                if (numInputs == 1) {
                   
                    // this is for multi-query merge where
View Full Code Here

       
        // For each indexed tup in the inp, split them up and place their
        // fields into the proper bags.  If the given field isn't a bag, just
        // set the value as is.
        while (tupIter.hasNext()) {
            NullableTuple ntup = tupIter.next();
            Tuple tup = (Tuple)ntup.getValueAsPigType();
           
            int tupIndex = 0; // an index for accessing elements from
                              // the value (tup) that we have currently
            for(int i = 0; i < mBags.length; i++) {
                Integer keyIndex = keyLookup.get(i);
View Full Code Here

                              
                //For each indexed tup in the inp, sort them
                //into their corresponding bags based
                //on the index
                while (tupIter.hasNext()) {
                    NullableTuple ntup = tupIter.next();
                    int index = ntup.getIndex();
                    Tuple copy = getValueTuple(ntup, index)
                   
                    if (numInputs == 1) {
                       
                        // this is for multi-query merge where
View Full Code Here

            }
                       
            key = currKey;     
            for(int i=0; i<batchSize; i++) {
                if (iter.hasNext()) {
                     NullableTuple ntup = iter.next();
                     int index = ntup.getIndex();
                     Tuple copy = getValueTuple(ntup, index);               
                     if (numInputs == 1) {
                           
                            // this is for multi-query merge where
                            // the numInputs is always 1, but the index
View Full Code Here

                        if(redRes.returnStatus==POStatus.STATUS_OK){
                            Tuple tuple = (Tuple)redRes.result;
                            Byte index = (Byte)tuple.get(0);
                            PigNullableWritable outKey =
                                HDataType.getWritableComparableTypes(tuple.get(1), this.keyType);
                            NullableTuple val =
                                new NullableTuple((Tuple)tuple.get(2));
                            // Both the key and the value need the index.  The key needs it so
                            // that it can be sorted on the index in addition to the key
                            // value.  The value needs it so that POPackage can properly
                            // assign the tuple to its slot in the projection.
                            outKey.setIndex(index);
                            val.setIndex(index);
                            oc.collect(outKey, val);
                            continue;
                        }
                       
                        if(redRes.returnStatus==POStatus.STATUS_EOP)
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.io.NullableTuple

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.