org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators
Class POProject

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.expressionOperators.ExpressionOperator
              extended by org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Operator>, Illustrable
Direct Known Subclasses:
PORelationToExprProject

public class POProject
extends ExpressionOperator

Implements the overloaded form of the project operator. Projects the specified column from the input tuple. However, if asked for tuples when the input is a bag, the overloaded form is invoked and the project streams the tuples through instead of the bag.

See Also:
Serialized Form

Field Summary
protected static BagFactory bagFactory
           
protected  ArrayList<Integer> columns
           
 
Fields inherited from class org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
alias, dummyBag, dummyBool, dummyDBA, dummyDouble, dummyFloat, dummyInt, dummyLong, dummyMap, dummyString, dummyTuple, illustrator, input, inputAttached, inputs, lineageTracer, outputs, parentPlan, pigLogger, reporter, requestedParallelism, res, resultType
 
Fields inherited from class org.apache.pig.impl.plan.Operator
mKey
 
Constructor Summary
POProject(OperatorKey k)
           
POProject(OperatorKey k, int rp)
           
POProject(OperatorKey k, int rp, ArrayList<Integer> cols)
           
POProject(OperatorKey k, int rp, int col)
           
 
Method Summary
 void attachInput(Tuple t)
          Overridden since the attachment of the new input should cause the old processing to end.
 POProject clone()
          Make a deep copy of this operator.
protected  Result consumeInputBag(Result input)
           
 List<ExpressionOperator> getChildExpressions()
          Get the sub-expressions of this expression.
 int getColumn()
           
 ArrayList<Integer> getColumns()
           
 Result getNext()
          Fetches the input tuple and returns the requested column
 Result getNext(Boolean b)
           
 Result getNext(DataBag db)
           
 Result getNext(DataByteArray ba)
           
 Result getNext(Double d)
           
 Result getNext(Float f)
           
 Result getNext(Integer i)
           
 Result getNext(Long l)
           
 Result getNext(Map m)
           
 Result getNext(String s)
           
 Result getNext(Tuple t)
          Asked for Tuples.
 int getStartCol()
           
 Tuple illustratorMarkup(Object in, Object out, int eqClassIndex)
          input tuple mark up to be illustrate-able
 boolean isOverloaded()
           
 boolean isProjectToEnd()
           
 boolean isStar()
           
 String name()
           
protected  Result processInputBag()
           
 void setColumn(int col)
           
 void setColumns(ArrayList<Integer> cols)
           
 void setOverloaded(boolean overloaded)
           
 void setProjectToEnd(int startCol)
           
 void setResultSingleTupleBag(boolean resultSingleTupleBag)
           
 void setStar(boolean star)
           
 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.expressionOperators.ExpressionOperator
accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, accumChild, containUDF, setIllustrator
 
Methods inherited from class org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator
cloneHelper, detachInput, getAlias, getAliasString, getDummy, getIllustrator, getInputs, getLogger, getNext, getPigLogger, getRequestedParallelism, getResultType, isAccumStarted, isAccumulative, isBlocking, isInputAttached, processInput, reset, setAccumEnd, setAccumStart, setAccumulative, setAlias, 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

bagFactory

protected static final BagFactory bagFactory

columns

protected ArrayList<Integer> columns
Constructor Detail

POProject

public POProject(OperatorKey k)

POProject

public POProject(OperatorKey k,
                 int rp)

POProject

public POProject(OperatorKey k,
                 int rp,
                 int col)

POProject

public POProject(OperatorKey k,
                 int rp,
                 ArrayList<Integer> cols)
Method Detail

setProjectToEnd

public void setProjectToEnd(int startCol)

name

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

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.

Overrides:
supportsMultipleOutputs in class ExpressionOperator
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 ExpressionOperator
Parameters:
v - Visitor to visit with.
Throws:
VisitorException - if the visitor has a problem.

attachInput

public void attachInput(Tuple t)
Overridden since the attachment of the new input should cause the old processing to end.

Overrides:
attachInput in class PhysicalOperator
Parameters:
t - - The tuple that should be used as input

getNext

public Result getNext()
               throws ExecException
Fetches the input tuple and returns the requested column

Returns:
next value.
Throws:
ExecException

getNext

public Result getNext(DataBag db)
               throws ExecException
Overrides:
getNext in class ExpressionOperator
Throws:
ExecException

consumeInputBag

protected Result consumeInputBag(Result input)
                          throws ExecException
Parameters:
input -
Throws:
ExecException

getNext

public Result getNext(DataByteArray ba)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Double d)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Float f)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Integer i)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Long l)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Boolean b)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Map m)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(String s)
               throws ExecException
Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getNext

public Result getNext(Tuple t)
               throws ExecException
Asked for Tuples. Check if the input is a bag. If so, stream the tuples in the bag instead of the entire bag.

Overrides:
getNext in class PhysicalOperator
Throws:
ExecException

getColumns

public ArrayList<Integer> getColumns()

getColumn

public int getColumn()
              throws ExecException
Throws:
ExecException

getStartCol

public int getStartCol()

setColumns

public void setColumns(ArrayList<Integer> cols)

setColumn

public void setColumn(int col)

isOverloaded

public boolean isOverloaded()

setOverloaded

public void setOverloaded(boolean overloaded)

isStar

public boolean isStar()

isProjectToEnd

public boolean isProjectToEnd()

setStar

public void setStar(boolean star)

clone

public POProject clone()
                throws CloneNotSupportedException
Description copied from class: ExpressionOperator
Make a deep copy of this operator. This is declared here to make it possible to call clone on ExpressionOperators.

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

processInputBag

protected Result processInputBag()
                          throws ExecException
Throws:
ExecException

setResultSingleTupleBag

public void setResultSingleTupleBag(boolean resultSingleTupleBag)

getChildExpressions

public List<ExpressionOperator> getChildExpressions()
Description copied from class: ExpressionOperator
Get the sub-expressions of this expression. This is called if reducer is run as accumulative mode, all the child expression must be called if they have any UDF to drive the UDF.accumulate()

Specified by:
getChildExpressions in class ExpressionOperator

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