org.apache.pig.newplan.logical.relational
Class LogicalRelationalOperator

java.lang.Object
  extended by org.apache.pig.newplan.Operator
      extended by org.apache.pig.newplan.logical.relational.LogicalRelationalOperator
Direct Known Subclasses:
LOCogroup, LOCross, LODistinct, LOFilter, LOForEach, LOGenerate, LOInnerLoad, LOJoin, LOLimit, LOLoad, LONative, LOSort, LOSplit, LOSplitOutput, LOStore, LOStream, LOUnion

public abstract class LogicalRelationalOperator
extends Operator

Logical representation of relational operators. Relational operators have a schema.


Field Summary
protected  String alias
           
protected  int lineNum
           
protected  String mCustomPartitioner
          Name of the customPartitioner if one is used, this is set to null otherwise.
protected  int requestedParallelism
           
protected  LogicalSchema schema
           
 
Fields inherited from class org.apache.pig.newplan.Operator
annotations, hashPrime, name, plan
 
Constructor Summary
LogicalRelationalOperator(String name, OperatorPlan plan)
           
LogicalRelationalOperator(String name, OperatorPlan plan, int rp)
           
 
Method Summary
protected  boolean checkEquality(LogicalRelationalOperator other)
          Do some basic equality checks on two relational operators.
 String getAlias()
          Get the alias of this operator.
 String getCustomPartitioner()
           
 int getLineNumber()
          Get the line number in the submitted Pig Latin script where this operator occurred.
 int getRequestedParallelisam()
          Get the requestedParallelism for this operator.
abstract  LogicalSchema getSchema()
          Get the schema for the output of this relational operator.
 void neverUseForRealSetSchema(LogicalSchema schema)
          Only to be used by unit tests.
 void resetSchema()
          Reset the schema to null so that the next time getSchema is called the schema will be regenerated from scratch.
 void resetUid()
          Erase all cached uid, regenerate uid when we regenerating schema.
 void setAlias(String alias)
           
 void setCustomPartitioner(String customPartitioner)
           
 void setRequestedParallelism(int parallel)
           
 void setSchema(LogicalSchema schema)
           
 String toString()
           
 
Methods inherited from class org.apache.pig.newplan.Operator
accept, annotate, getAnnotation, getName, getPlan, isEqual, removeAnnotation, setPlan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

schema

protected LogicalSchema schema

requestedParallelism

protected int requestedParallelism

alias

protected String alias

lineNum

protected int lineNum

mCustomPartitioner

protected String mCustomPartitioner
Name of the customPartitioner if one is used, this is set to null otherwise.

Constructor Detail

LogicalRelationalOperator

public LogicalRelationalOperator(String name,
                                 OperatorPlan plan)
Parameters:
name - of this operator
plan - this operator is in

LogicalRelationalOperator

public LogicalRelationalOperator(String name,
                                 OperatorPlan plan,
                                 int rp)
Parameters:
name - of this operator
plan - this operator is in
rp - requested parallelism
Method Detail

getSchema

public abstract LogicalSchema getSchema()
                                 throws FrontendException
Get the schema for the output of this relational operator. This does not merely return the schema variable. If schema is not yet set, this will attempt to construct it. Therefore it is abstract since each operator will need to construct its schema differently.

Returns:
the schema
Throws:
FrontendException

setSchema

public void setSchema(LogicalSchema schema)

resetSchema

public void resetSchema()
Reset the schema to null so that the next time getSchema is called the schema will be regenerated from scratch.


resetUid

public void resetUid()
Erase all cached uid, regenerate uid when we regenerating schema. This process currently only used in ImplicitSplitInsert, which will insert split and invalidate some uids in plan


getRequestedParallelisam

public int getRequestedParallelisam()
Get the requestedParallelism for this operator.

Returns:
requestedParallelsim

getAlias

public String getAlias()
Get the alias of this operator. That is, if the Pig Latin for this operator was 'X = sort W by $0' then the alias will be X. For store and split it will be the alias being stored or split. Note that because of this this alias is not guaranteed to be unique to a single operator.

Returns:
alias

setAlias

public void setAlias(String alias)

setRequestedParallelism

public void setRequestedParallelism(int parallel)

getLineNumber

public int getLineNumber()
Get the line number in the submitted Pig Latin script where this operator occurred.

Returns:
line number

neverUseForRealSetSchema

public void neverUseForRealSetSchema(LogicalSchema schema)
Only to be used by unit tests. This is a back door cheat to set the schema without having to calculate it. This should never be called by production code, only by tests.

Parameters:
schema - to set

checkEquality

protected boolean checkEquality(LogicalRelationalOperator other)
                         throws FrontendException
Do some basic equality checks on two relational operators. Equality is defined here as having equal schemas and predecessors that are equal. This is intended to be used by operators' equals methods.

Parameters:
other - LogicalRelationalOperator to compare predecessors against
Returns:
true if the isEquals() methods of this node's predecessor(s) returns true when invoked with other's predecessor(s).
Throws:
FrontendException

toString

public String toString()
Overrides:
toString in class Object

getCustomPartitioner

public String getCustomPartitioner()

setCustomPartitioner

public void setCustomPartitioner(String customPartitioner)


Copyright © ${year} The Apache Software Foundation