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

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.BagDereferenceExpression

public class BagDereferenceExpression
extends ColumnExpression

This is a special case Expression and violates some of the rules of an Expression. Violation: It has multiple Uids ( though not tracked there can be multiple uids for this expression ) This is a special operator which handles the case described below Tuple( a:int, b:bag{ b_a:int, b_b:float } ) --> BagDereference ( 0 ) --> project( 0, 1 ) --> bag{ b_a:float } i.e. First input ( 0 ), second column ( 1 ) and first column of the bag.


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
BagDereferenceExpression(OperatorPlan plan, byte type, int colNum, ProjectExpression exp)
           
BagDereferenceExpression(OperatorPlan plan, byte type, List<Integer> columnNums, ProjectExpression exp)
           
 
Method Summary
 void accept(PlanVisitor v)
          Accept a visitor at this node in the graph.
 int getBagColNum()
          Column number in the bag at column col this Dereference References.
 List<Integer> getBagColumns()
           
 ProjectExpression getProjectExpression()
           
 boolean isEqual(Operator other)
          This is like a shallow equals comparison.
 void setBagColNum(int colNum)
           
 void setBagColumns(List<Integer> columns)
           
 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

BagDereferenceExpression

public BagDereferenceExpression(OperatorPlan plan,
                                byte type,
                                int colNum,
                                ProjectExpression exp)

BagDereferenceExpression

public BagDereferenceExpression(OperatorPlan plan,
                                byte type,
                                List<Integer> columnNums,
                                ProjectExpression exp)
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

getBagColNum

public int getBagColNum()
Column number in the bag at column col this Dereference References. The column number is the column in the relational operator that contains this expression. The count is zero based.

Returns:
column number

getBagColumns

public List<Integer> getBagColumns()

setBagColumns

public void setBagColumns(List<Integer> columns)

setBagColNum

public void setBagColNum(int colNum)

setType

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

Parameters:
type - to set this projection to

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

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

getProjectExpression

public ProjectExpression getProjectExpression()
                                       throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class LogicalExpression


Copyright © ${year} The Apache Software Foundation