org.apache.pig.impl.logicalLayer
Class LOProject

java.lang.Object
  extended by org.apache.pig.impl.plan.Operator<LOVisitor>
      extended by org.apache.pig.impl.logicalLayer.LogicalOperator
          extended by org.apache.pig.impl.logicalLayer.ExpressionOperator
              extended by org.apache.pig.impl.logicalLayer.LOProject
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Operator>

public class LOProject
extends ExpressionOperator

LOProject is designed like a singly linked list; A few examples will illustrate the point about the linked list nature of the design; a = load 'input1' as (name, age); b = group a by name; foreach b generate a, a.name; The project operator occurs in two places in the above script: generate a(here) and a.name(here) In the first occurrence, we are trying to project the elements of the bag a; In order to retrieve the bag, we need to project the the second column ($1) or column number 1 (using the zero based index) from the input (the relation or bag b) In the second occurence, we are trying to project the first column ($0) or column number 0 from the bag a which in turn is the column number 1 in the relation b; As you can see, the nested structure or the singly linked list nature is clearly visible; Given that it's a singly linked list, the null pointer or the sentinel is marked explictly using the boolean variable mSentinel; The sentinel is marked true only when the input is a relational operator; This occurs when we create the innermost operator

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.pig.impl.logicalLayer.ExpressionOperator
mFieldSchema, mIsFieldSchemaComputed
 
Fields inherited from class org.apache.pig.impl.logicalLayer.LogicalOperator
mAlias, mCustomPartitioner, mIsProjectionMapComputed, mIsSchemaComputed, mPinnedOptions, mPlan, mProjectionMap, mRequestedParallelism, mSchema, mType
 
Fields inherited from class org.apache.pig.impl.plan.Operator
mKey
 
Constructor Summary
LOProject(LogicalPlan plan, OperatorKey key, LogicalOperator exp, Integer projection)
           
LOProject(LogicalPlan plan, OperatorKey key, LogicalOperator exp, List<Integer> projection)
           
 
Method Summary
protected  Object clone()
           
 int getCol()
           
 LogicalOperator getExpression()
           
 Schema.FieldSchema getFieldSchema()
           
 boolean getOverloaded()
           
 List<Integer> getProjection()
           
 Schema getSchema()
          Get a copy of the schema for the output of this operator.
 boolean getSentinel()
           
 boolean isSendEmptyBagOnEOP()
           
 boolean isSingleProjection()
           
 boolean isStar()
           
 String name()
           
 void setExpression(LogicalOperator exp)
           
 void setOverloaded(boolean b)
           
 void setProjection(List<Integer> proj)
           
 void setSendEmptyBagOnEOP(boolean sendEmptyBagOnEOP)
           
 void setSentinel(boolean b)
           
 void setStar(boolean b)
           
 boolean supportsMultipleInputs()
          Indicates whether this operator supports multiple inputs.
 String toDetailString()
           
 void visit(LOVisitor v)
          Visit this node with the provided visitor.
 
Methods inherited from class org.apache.pig.impl.logicalLayer.ExpressionOperator
getType, regenerateFieldSchema, setFieldSchema, supportsMultipleOutputs, unsetFieldSchema
 
Methods inherited from class org.apache.pig.impl.logicalLayer.LogicalOperator
forceSchema, getAlias, getAliasString, getCustomPartitioner, getOperatorKey, getPlan, getRequestedParallelism, isPinnedOption, pinOption, reconcileSchema, regenerateSchema, setAlias, setCanonicalNames, setCustomPartitioner, setParent, setPlan, setRequestedParallelism, setSchema, setSchemaComputed, setType, toString, unsetSchema
 
Methods inherited from class org.apache.pig.impl.plan.Operator
compareTo, equals, getProjectionMap, hashCode, regenerateProjectionMap, rewire, unsetProjectionMap
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LOProject

public LOProject(LogicalPlan plan,
                 OperatorKey key,
                 LogicalOperator exp,
                 List<Integer> projection)
Parameters:
plan - Logical plan this operator is a part of.
key - Operator key to assign to this node.
exp - the expression which might contain the column to project
projection - the list of columns to project

LOProject

public LOProject(LogicalPlan plan,
                 OperatorKey key,
                 LogicalOperator exp,
                 Integer projection)
Parameters:
plan - Logical plan this operator is a part of.
key - Operator key to assign to this node.
exp - the expression which might contain the column to project
projection - the column to project
Method Detail

getExpression

public LogicalOperator getExpression()

setExpression

public void setExpression(LogicalOperator exp)

isStar

public boolean isStar()

getProjection

public List<Integer> getProjection()

setProjection

public void setProjection(List<Integer> proj)

getCol

public int getCol()

setStar

public void setStar(boolean b)

getSentinel

public boolean getSentinel()

setSentinel

public void setSentinel(boolean b)

getOverloaded

public boolean getOverloaded()

setOverloaded

public void setOverloaded(boolean b)

name

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

supportsMultipleInputs

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

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

getFieldSchema

public Schema.FieldSchema getFieldSchema()
                                  throws FrontendException
Overrides:
getFieldSchema in class ExpressionOperator
Throws:
FrontendException

isSingleProjection

public boolean isSingleProjection()

visit

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

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

getSchema

public Schema getSchema()
                 throws FrontendException
Description copied from class: LogicalOperator
Get a copy of the schema for the output of this operator.

Overrides:
getSchema in class ExpressionOperator
Throws:
FrontendException

toDetailString

public String toDetailString()

clone

protected Object clone()
                throws CloneNotSupportedException
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}

setSendEmptyBagOnEOP

public void setSendEmptyBagOnEOP(boolean sendEmptyBagOnEOP)
Parameters:
sendEmptyBagOnEOP - the sendEmptyBagOnEOP to set

isSendEmptyBagOnEOP

public boolean isSendEmptyBagOnEOP()
Returns:
the sendEmptyBagOnEOP


Copyright © ${year} The Apache Software Foundation