org.apache.pig.impl.logicalLayer
Class LOProject
java.lang.Object
org.apache.pig.impl.plan.Operator<LOVisitor>
org.apache.pig.impl.logicalLayer.LogicalOperator
org.apache.pig.impl.logicalLayer.ExpressionOperator
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
Fields inherited from class org.apache.pig.impl.plan.Operator |
mKey |
Methods inherited from class org.apache.pig.impl.logicalLayer.LogicalOperator |
forceSchema, getAlias, getOperatorKey, getPlan, getProjectionMap, getRequestedParallelism, getRequiredFields, reconcileSchema, regenerateSchema, setAlias, setCanonicalNames, setPlan, setRequestedParallelism, setSchema, setSchemaComputed, setType, toString, unsetSchema |
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 projectprojection
- 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 projectprojection
- the column to project
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