org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators
Class POSort

java.lang.Object
  extended by org.apache.pig.impl.plan.Operator<PhyPlanVisitor>
      extended by org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
          extended by org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POSort
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Operator>, Illustrable

public class POSort
extends PhysicalOperator

This implementation is applicable for both the physical plan and for the local backend, as the conversion of physical to mapreduce would see the SORT operator and take necessary steps to convert it to a quantile and a sort job. This is a blocking operator. The sortedDataBag accumulates Tuples and sorts them only when there an iterator is started. So all the tuples from the input operator should be accumulated and filled into the dataBag. The attachInput method is not applicable here.

See Also:
Serialized Form

Nested Class Summary
 class POSort.SortComparator
           
 class POSort.UDFSortComparator
           
 
Nested classes/interfaces inherited from class org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
PhysicalOperator.OriginalLocation
 
Field Summary
 boolean isUDFComparatorUsed
           
 
Fields inherited from class org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
alias, illustrator, input, inputAttached, inputs, lineageTracer, outputs, parentPlan, pigLogger, requestedParallelism, res, resultType
 
Fields inherited from class org.apache.pig.impl.plan.Operator
mKey
 
Constructor Summary
POSort(OperatorKey k)
           
POSort(OperatorKey k, int rp)
           
POSort(OperatorKey k, int rp, List inp)
           
POSort(OperatorKey k, int rp, List inp, List<PhysicalPlan> sortPlans, List<Boolean> mAscCols, POUserComparisonFunc mSortFunc)
           
POSort(OperatorKey k, List inp)
           
 
Method Summary
 POSort clone()
          Make a deep copy of this operator.
 long getLimit()
           
 List<Boolean> getMAscCols()
           
 POUserComparisonFunc getMSortFunc()
           
 Result getNextTuple()
           
 List<PhysicalPlan> getSortPlans()
           
 Tuple illustratorMarkup(Object in, Object out, int eqClassIndex)
          input tuple mark up to be illustrate-able
 boolean isBlocking()
          A blocking operator should override this to return true.
 boolean isLimited()
           
 String name()
           
 void reset()
          Reset internal state in an operator.
 void setLimit(long l)
           
 void setMSortFunc(POUserComparisonFunc sortFunc)
           
 void setSortPlans(List<PhysicalPlan> sortPlans)
           
 boolean supportsMultipleInputs()
          Indicates whether this operator supports multiple inputs.
 boolean supportsMultipleOutputs()
          Indicates whether this operator supports multiple outputs.
 void visit(PhyPlanVisitor v)
          Visit this node with the provided visitor.
 
Methods inherited from class org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
addOriginalLocation, addOriginalLocation, attachInput, cloneHelper, detachInput, getAlias, getAliasString, getIllustrator, getInputs, getLogger, getNext, getNextBigDecimal, getNextBigInteger, getNextBoolean, getNextDataBag, getNextDataByteArray, getNextDateTime, getNextDouble, getNextFloat, getNextInteger, getNextLong, getNextMap, getNextString, getOriginalLocations, getPigLogger, getReporter, getRequestedParallelism, getResultType, isAccumStarted, isAccumulative, isInputAttached, processInput, setAccumEnd, setAccumStart, setAccumulative, setIllustrator, setInputs, setParentPlan, setPigLogger, setReporter, setRequestedParallelism, setResultType
 
Methods inherited from class org.apache.pig.impl.plan.Operator
compareTo, equals, getOperatorKey, getProjectionMap, hashCode, regenerateProjectionMap, rewire, toString, unsetProjectionMap
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

isUDFComparatorUsed

public boolean isUDFComparatorUsed
Constructor Detail

POSort

public POSort(OperatorKey k,
              int rp,
              List inp,
              List<PhysicalPlan> sortPlans,
              List<Boolean> mAscCols,
              POUserComparisonFunc mSortFunc)

POSort

public POSort(OperatorKey k,
              int rp,
              List inp)

POSort

public POSort(OperatorKey k,
              int rp)

POSort

public POSort(OperatorKey k,
              List inp)

POSort

public POSort(OperatorKey k)
Method Detail

name

public String name()
Specified by:
name in class Operator<PhyPlanVisitor>

isBlocking

public boolean isBlocking()
Description copied from class: PhysicalOperator
A blocking operator should override this to return true. Blocking operators are those that need the full bag before operate on the tuples inside the bag. Example is the Global Rearrange. Non-blocking or pipeline operators are those that work on a tuple by tuple basis.

Overrides:
isBlocking in class PhysicalOperator
Returns:
true if blocking and false otherwise

getNextTuple

public Result getNextTuple()
                    throws ExecException
Overrides:
getNextTuple in class PhysicalOperator
Throws:
ExecException

supportsMultipleInputs

public boolean supportsMultipleInputs()
Description copied from class: Operator
Indicates whether this operator supports multiple inputs.

Specified by:
supportsMultipleInputs in class Operator<PhyPlanVisitor>
Returns:
true if it does, otherwise false.

supportsMultipleOutputs

public boolean supportsMultipleOutputs()
Description copied from class: Operator
Indicates whether this operator supports multiple outputs.

Specified by:
supportsMultipleOutputs in class Operator<PhyPlanVisitor>
Returns:
true if it does, otherwise false.

visit

public void visit(PhyPlanVisitor v)
           throws VisitorException
Description copied from class: Operator
Visit this node with the provided visitor. This should only be called by the visitor class itself, never directly.

Specified by:
visit in class PhysicalOperator
Parameters:
v - Visitor to visit with.
Throws:
VisitorException - if the visitor has a problem.

reset

public void reset()
Description copied from class: PhysicalOperator
Reset internal state in an operator. For use in nested pipelines where operators like limit and sort may need to reset their state. Limit needs it because it needs to know it's seeing a fresh set of input. Blocking operators like sort and distinct need it because they may not have drained their previous input due to a limit and thus need to be told to drop their old input and start over.

Overrides:
reset in class PhysicalOperator

getSortPlans

public List<PhysicalPlan> getSortPlans()

setSortPlans

public void setSortPlans(List<PhysicalPlan> sortPlans)

getMSortFunc

public POUserComparisonFunc getMSortFunc()

setMSortFunc

public void setMSortFunc(POUserComparisonFunc sortFunc)

getMAscCols

public List<Boolean> getMAscCols()

setLimit

public void setLimit(long l)

getLimit

public long getLimit()

isLimited

public boolean isLimited()

clone

public POSort clone()
             throws CloneNotSupportedException
Description copied from class: PhysicalOperator
Make a deep copy of this operator. This function is blank, however, we should leave a place holder so that the subclasses can clone

Overrides:
clone in class PhysicalOperator
Throws:
CloneNotSupportedException
See Also:
Do not use the clone method directly. Operators are cloned when logical plans are cloned using {@link LogicalPlanCloner}

illustratorMarkup

public Tuple illustratorMarkup(Object in,
                               Object out,
                               int eqClassIndex)
Description copied from interface: Illustrable
input tuple mark up to be illustrate-able

Parameters:
in - input tuple
out - output tuple before wrapped in ExampleTuple
eqClassIndex - index into equivalence classes in illustrator
Returns:
tuple


Copyright © 2007-2012 The Apache Software Foundation