org.apache.pig.experimental.logical.expression
Class BagDereferenceExpression
java.lang.Object
org.apache.pig.experimental.plan.Operator
org.apache.pig.experimental.logical.expression.LogicalExpression
org.apache.pig.experimental.logical.expression.ColumnExpression
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.
BagDereferenceExpression
public BagDereferenceExpression(OperatorPlan plan,
byte type,
int colNum,
ProjectExpression exp)
BagDereferenceExpression
public BagDereferenceExpression(OperatorPlan plan,
byte type,
List<Integer> columnNums,
ProjectExpression exp)
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