org.apache.pig.newplan.logical.expression
Class LogicalExpression

java.lang.Object
  extended by org.apache.pig.newplan.Operator
      extended by org.apache.pig.newplan.logical.expression.LogicalExpression
Direct Known Subclasses:
BinaryExpression, BinCondExpression, ColumnExpression, UnaryExpression, UserFuncExpression

public abstract class LogicalExpression
extends Operator

Logical representation of expression operators. Expression operators have a data type and a uid. Uid is a unique id for each expression.


Field Summary
protected  LogicalSchema.LogicalFieldSchema fieldSchema
           
protected  LogicalSchema.LogicalFieldSchema uidOnlyFieldSchema
           
 
Fields inherited from class org.apache.pig.newplan.Operator
annotations, hashPrime, location, name, plan
 
Constructor Summary
LogicalExpression(String name, OperatorPlan plan)
           
 
Method Summary
abstract  LogicalExpression deepCopy(LogicalExpressionPlan lgExpPlan)
          Create the deep copy of this expression and add that into the passed LogicalExpressionPlan Return the copy of this expression with updated logical expression plan.
abstract  LogicalSchema.LogicalFieldSchema getFieldSchema()
          Get the field schema for the output of this expression operator.
static long getNextUid()
           
 byte getType()
          Get the data type for this expression.
 boolean hasFieldSchema()
          This is a convenience method to avoid the side-effectful nature of getFieldSchema().
 void neverUseForRealSetFieldSchema(LogicalSchema.LogicalFieldSchema fs)
           
 void resetFieldSchema()
           
static void resetNextUid()
           
 void resetUid()
          Erase all cached uid, regenerate uid when we regenerating schema.
 String toString()
           
 
Methods inherited from class org.apache.pig.newplan.Operator
accept, annotate, getAnnotation, getLocation, getName, getPlan, isEqual, removeAnnotation, setLocation, setPlan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fieldSchema

protected LogicalSchema.LogicalFieldSchema fieldSchema

uidOnlyFieldSchema

protected LogicalSchema.LogicalFieldSchema uidOnlyFieldSchema
Constructor Detail

LogicalExpression

public LogicalExpression(String name,
                         OperatorPlan plan)
Parameters:
name - of the operator
plan - LogicalExpressionPlan this is part of
Method Detail

getNextUid

public static long getNextUid()

resetNextUid

public static void resetNextUid()

hasFieldSchema

public boolean hasFieldSchema()
This is a convenience method to avoid the side-effectful nature of getFieldSchema(). It simply returns whether or not fieldSchema is currently null.


getFieldSchema

public abstract LogicalSchema.LogicalFieldSchema getFieldSchema()
                                                         throws FrontendException
Get the field schema for the output of this expression operator. This does not merely return the field 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 field schema differently.

Returns:
the FieldSchema
Throws:
FrontendException

resetFieldSchema

public void resetFieldSchema()

getType

public byte getType()
             throws FrontendException
Get the data type for this expression.

Returns:
data type, one of the static bytes of DataType
Throws:
FrontendException

toString

public String toString()
Overrides:
toString in class Object

neverUseForRealSetFieldSchema

public void neverUseForRealSetFieldSchema(LogicalSchema.LogicalFieldSchema fs)
                                   throws FrontendException
Throws:
FrontendException

deepCopy

public abstract LogicalExpression deepCopy(LogicalExpressionPlan lgExpPlan)
                                    throws FrontendException
Create the deep copy of this expression and add that into the passed LogicalExpressionPlan Return the copy of this expression with updated logical expression plan.

Parameters:
lgExpPlan - LogicalExpressionPlan in which this expression will be added.
Returns:
LogicalExpression with its own logical expression plan.
Throws:
IOException.
FrontendException

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



Copyright © 2007-2012 The Apache Software Foundation