org.apache.pig.experimental.logical.expression
Class ProjectExpression

java.lang.Object
  extended by org.apache.pig.experimental.plan.Operator
      extended by org.apache.pig.experimental.logical.expression.LogicalExpression
          extended by org.apache.pig.experimental.logical.expression.ColumnExpression
              extended by org.apache.pig.experimental.logical.expression.ProjectExpression

public class ProjectExpression
extends ColumnExpression

Projection of columns in an expression.


Field Summary
 
Fields inherited from class org.apache.pig.experimental.logical.expression.LogicalExpression
type, uid
 
Fields inherited from class org.apache.pig.experimental.plan.Operator
annotations, hashPrime, name, plan
 
Constructor Summary
ProjectExpression(OperatorPlan plan, byte type, int inputNum, int colNum)
          Adds projection to the plan.
 
Method Summary
 void accept(PlanVisitor v)
          Accept a visitor at this node in the graph.
 LogicalRelationalOperator findReferent(LogicalRelationalOperator currentOp)
          Find the LogicalRelationalOperator that this projection refers to.
 int getColNum()
          Column number this project references.
 int getInputNum()
          Input number this project references.
 boolean isEqual(Operator other)
          This is like a shallow equals comparison.
 boolean isProjectStar()
           
 void setColNum(int colNum)
          Set the column number for this project.
 void setInputNum(int inputNum)
           
 void setType(byte type)
          Set the type of the projection.
 void setUid(LogicalRelationalOperator currentOp)
          Set the uid.
 String toString()
           
 
Methods inherited from class org.apache.pig.experimental.logical.expression.LogicalExpression
getNextUid, getType, getUid, neverUseForRealSetUid, resetNextUid
 
Methods inherited from class org.apache.pig.experimental.plan.Operator
annotate, getAnnotation, getName, getPlan, removeAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectExpression

public ProjectExpression(OperatorPlan plan,
                         byte type,
                         int inputNum,
                         int colNum)
Adds projection to the plan.

Parameters:
plan - LogicalExpressionPlan this projection will be a part of
type - type of this projection, can be unknown
inputNum - Input number this project references.
colNum - Column number this project references.
Method Detail

accept

public void accept(PlanVisitor v)
            throws IOException
Description copied from class: Operator
Accept a visitor at this node in the graph.

Specified by:
accept in class Operator
Parameters:
v - Visitor to accept.
Throws:
IOException

getInputNum

public int getInputNum()
Input number this project references. This is the input number for the relational operator that contains this expression. The count is zero based.

Returns:
input number

setInputNum

public void setInputNum(int inputNum)

getColNum

public int getColNum()
Column number this project references. The column number is the column in the relational operator that contains this expression. The count is zero based.

Returns:
column number

setColNum

public void setColNum(int colNum)
Set the column number for this project. This should only be called by ProjectionPatcher. Stupid Java needs friends.

Parameters:
colNum - new column number for projection

setType

public void setType(byte type)
Set the type of the projection.

Parameters:
type - to set this projection to

isProjectStar

public boolean isProjectStar()

setUid

public void setUid(LogicalRelationalOperator currentOp)
            throws IOException
Description copied from class: LogicalExpression
Set the uid. For most expressions this will get a new uid. ProjectExpression needs to override this and find its uid from its predecessor.

Overrides:
setUid in class LogicalExpression
Parameters:
currentOp - Current LogicalRelationalOperator that this expression operator is attached to. Passed so that projection operators can determine their uid.
Throws:
IOException

findReferent

public LogicalRelationalOperator findReferent(LogicalRelationalOperator currentOp)
                                       throws IOException
Find the LogicalRelationalOperator that this projection refers to.

Parameters:
currentOp - Current operator this projection is attached to
Returns:
LRO this projection refers to
Throws:
IOException

isEqual

public boolean isEqual(Operator other)
Description copied from class: Operator
This is like a shallow equals comparison. It returns true if two operators have equivalent properties even if they are different objects. Here properties mean equivalent plan and equivalent name.

Specified by:
isEqual in class Operator
Returns:
true if two object have equivalent properties, else false

toString

public String toString()
Overrides:
toString in class LogicalExpression


Copyright © ${year} The Apache Software Foundation