Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */

 
 package org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators;
 
 import java.util.List;
 import java.util.Map;
 
 
This package operator is a specialization of POPackage operator used for the specific case of the order by query. See JIRA 802 for more details.
 
 public class POPackageLite extends POPackage {

    
 
     private static final long serialVersionUID = 1L;
 
     public POPackageLite(OperatorKey k) {
         super(k, -1, null);
     }
 
     public POPackageLite(OperatorKey kint rp) {
         super(krpnull);
     }
 
     public POPackageLite(OperatorKey kList<PhysicalOperatorinp) {
         super(k, -1, inp);
     }
 
     public POPackageLite(OperatorKey kint rpList<PhysicalOperatorinp) {
         super(krpinp);
     }
 
     /* (non-Javadoc)
      * @see org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POPackage#setNumInps(int)
      */
     public void setNumInps(int numInps) {
 		if(numInps != 1)
 		{
 			throw new RuntimeException("POPackageLite can only take 1 input");
 		}
         this. = numInps;
     }
 	
     public boolean[] getInner() {
         throw new RuntimeException("POPackageLite does not support getInner operation");
     }
 
     public void setInner(boolean[] inner) {
         throw new RuntimeException("POPackageLite does not support setInner operation");
     }
    
    
Make a deep copy of this operator.

    @Override
    public POPackageLite clone() throws CloneNotSupportedException {
        POPackageLite clone = (POPackageLite)super.clone();
        clone.inner = null;
        clone.keyInfo = new HashMap<IntegerPair<Boolean,Map<Integer,Integer>>>();
        for (Entry<IntegerPair<BooleanMap<Integer,Integer>>> entry.entrySet()) {
            clone.keyInfo.put(entry.getKey(), entry.getValue());
        }
        return clone;
    }
    
    

Returns:
the distinct
    @Override
    public boolean isDistinct() {
        throw new RuntimeException("POPackageLite does not support isDistinct operation");
    }

    

Parameters:
distinct the distinct to set
    @Override
    public void setDistinct(boolean distinct) {
        throw new RuntimeException("POPackageLite does not support setDistinct operation");
    }

    

Returns:
the isKeyTuple
    public boolean getKeyTuple() {
        return ;
    }

    

Returns:
the keyAsTuple
    public Tuple getKeyAsTuple() {
        return ;
    }

    

Returns:
the tupIter
    public Iterator<NullableTuplegetTupIter() {
        return ;
    }

    

Returns:
the key
    public Object getKey() {
        return ;
    }

    
Similar to POPackage.getNext except that only one input is expected with index 0 and ReadOnceBag is used instead of DefaultDataBag.
    @Override
    public Result getNextTuple() throws ExecException {
        Tuple res;
        //Create numInputs bags
        ReadOnceBag db = null;
        db = new ReadOnceBag(this);
        if(getReporter()!=null) {
            getReporter().progress();
        }
        
        //Construct the output tuple by appending
        //the key and all the above constructed bags
        //and return it.
        res = .newTuple(+1);
        res.set(0,);
        res.set(1,db);
        detachInput();
        Result r = new Result();
        r.returnStatus = .;
        r.result = illustratorMarkup(nullres, 0);
        return r;
    }
    
    
Makes use of the superclass method, but this requires an additional parameter key passed by ReadOnceBag. key of this instance will be set to null in detachInput call, but an instance of ReadOnceBag may have the original key that it uses. Therefore this extra argument is taken to temporarily set it before the call to the superclass method and then restore it.
    public Tuple getValueTuple(NullableTuple ntupint indexObject keythrows ExecException {
        Object origKey = this.;
        this. = key;
        Tuple retTuple = super.getValueTuple(ntupindex);
        this. = origKey;
        return retTuple;
    }
    @Override
    public String name() {
        return getAliasString() + "PackageLite" + "["
                + DataType.findTypeName() + "]" + "{"
                + DataType.findTypeName() + "}" + " - "
                + .toString();
    }
    
    @Override
    public Tuple illustratorMarkup(Object inObject outint eqClassIndex) {
        if( != null) {
            ExampleTuple tOut = new ExampleTuple((Tupleout);
            LineageTracer lineageTracer = .getLineage();
            lineageTracer.insert(tOut);
            if (.getEquivalenceClasses() == null) {
                LinkedList<IdentityHashSet<Tuple>> equivalenceClasses = new LinkedList<IdentityHashSet<Tuple>>();
                for (int i = 0; i < ; ++i) {
                    IdentityHashSet<TupleequivalenceClass = new IdentityHashSet<Tuple>();
                    equivalenceClasses.add(equivalenceClass);
                }
                .setEquivalenceClasses(equivalenceClassesthis);
            }
            .getEquivalenceClasses().get(eqClassIndex).add(tOut);
            tOut.synthetic = false;  // not expect this to be really used
            .addData((TupletOut);
            return tOut;
        } else
            return (Tupleout;
    }
New to GrepCode? Check out our FAQ X