org.apache.pig.newplan.logical.relational
Class LogicalSchema.LogicalFieldSchema

java.lang.Object
  extended by org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema
Enclosing class:
LogicalSchema

public static class LogicalSchema.LogicalFieldSchema
extends Object


Field Summary
 String alias
           
 LogicalSchema schema
           
 byte type
           
 long uid
           
 
Constructor Summary
LogicalSchema.LogicalFieldSchema(LogicalSchema.LogicalFieldSchema fs)
           
LogicalSchema.LogicalFieldSchema(String alias, LogicalSchema schema, byte type)
           
LogicalSchema.LogicalFieldSchema(String alias, LogicalSchema schema, byte type, long uid)
           
 
Method Summary
static boolean castable(LogicalSchema.LogicalFieldSchema inFs, LogicalSchema.LogicalFieldSchema outFs)
          Check if FieldSchema inFs is castable to outFs
 LogicalSchema.LogicalFieldSchema cloneUid()
           
 LogicalSchema.LogicalFieldSchema deepCopy()
           
static boolean equals(LogicalSchema.LogicalFieldSchema fschema, LogicalSchema.LogicalFieldSchema fother, boolean relaxInner, boolean relaxAlias)
          Compare two field schema for equality
 boolean isEqual(Object other)
          Equality is defined as having the same type and either the same schema or both null schema.
 boolean isEqual(Object other, boolean compareAlias)
          Equality is defined as having the same type and either the same schema or both null schema.
static LogicalSchema.LogicalFieldSchema merge(LogicalSchema.LogicalFieldSchema fs1, LogicalSchema.LogicalFieldSchema fs2, LogicalSchema.MergeMode mode)
          Merge two LogicalFieldSchema, the behavior of merge depends on mode.
 LogicalSchema.LogicalFieldSchema mergeUid(LogicalSchema.LogicalFieldSchema uidOnlyFieldSchema)
          Adds the uid from FieldSchema argument to this FieldSchema If the argument is null, it stamps this FieldSchema with uid
 void normalize()
          Old Pig field schema does not require a tuple schema inside a bag; Now it is required to have that; this method is to fill the gap
 void resetUid()
          Rest uid of this fieldschema and inner schema
 void stampFieldSchema()
          Give new value for uid if uid of field schema or those in fields schema of inner schema are -1.
 String toString()
           
 String toString(boolean verbose)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alias

public String alias

type

public byte type

uid

public long uid

schema

public LogicalSchema schema
Constructor Detail

LogicalSchema.LogicalFieldSchema

public LogicalSchema.LogicalFieldSchema(String alias,
                                        LogicalSchema schema,
                                        byte type)

LogicalSchema.LogicalFieldSchema

public LogicalSchema.LogicalFieldSchema(LogicalSchema.LogicalFieldSchema fs)

LogicalSchema.LogicalFieldSchema

public LogicalSchema.LogicalFieldSchema(String alias,
                                        LogicalSchema schema,
                                        byte type,
                                        long uid)
Method Detail

isEqual

public boolean isEqual(Object other)
Equality is defined as having the same type and either the same schema or both null schema. Alias and uid are not checked.


isEqual

public boolean isEqual(Object other,
                       boolean compareAlias)
Equality is defined as having the same type and either the same schema or both null schema. if compareAlias argument is set to true, alias is also compared.

Parameters:
other -
compareAlias -
Returns:
true if equal

toString

public String toString(boolean verbose)

toString

public String toString()
Overrides:
toString in class Object

stampFieldSchema

public void stampFieldSchema()
Give new value for uid if uid of field schema or those in fields schema of inner schema are -1.


mergeUid

public LogicalSchema.LogicalFieldSchema mergeUid(LogicalSchema.LogicalFieldSchema uidOnlyFieldSchema)
                                          throws FrontendException
Adds the uid from FieldSchema argument to this FieldSchema If the argument is null, it stamps this FieldSchema with uid

Parameters:
uidOnlyFieldSchema -
Returns:
FieldSchema
Throws:
FrontendException

resetUid

public void resetUid()
Rest uid of this fieldschema and inner schema


cloneUid

public LogicalSchema.LogicalFieldSchema cloneUid()

deepCopy

public LogicalSchema.LogicalFieldSchema deepCopy()

equals

public static boolean equals(LogicalSchema.LogicalFieldSchema fschema,
                             LogicalSchema.LogicalFieldSchema fother,
                             boolean relaxInner,
                             boolean relaxAlias)
Compare two field schema for equality

Parameters:
relaxInner - If true, we don't check inner tuple schemas
relaxAlias - If true, we don't check aliases
Returns:
true if FieldSchemas are equal, false otherwise

castable

public static boolean castable(LogicalSchema.LogicalFieldSchema inFs,
                               LogicalSchema.LogicalFieldSchema outFs)
Check if FieldSchema inFs is castable to outFs

Parameters:
inFs -
outFs -
Returns:
true if it is castable

merge

public static LogicalSchema.LogicalFieldSchema merge(LogicalSchema.LogicalFieldSchema fs1,
                                                     LogicalSchema.LogicalFieldSchema fs2,
                                                     LogicalSchema.MergeMode mode)
                                              throws FrontendException
Merge two LogicalFieldSchema, the behavior of merge depends on mode. If mode==MergeType.LoadForEach or MergeType.LoadForEachInner, take left side if compatible, otherwise, throw exception. If mode==MergeType.UnionInner, if not same type, throw exception, end up with null inner schema. If mode==MergeType.Union, take more specific type.

Parameters:
fs1 - In Load/Foreach, fs1 is user declared schema; in Union, fs1 is left side
fs2 - In Load/Foreach, fs1 is inferred schema; in Union, fs1 is left side
mode - merge mode
Throws:
FrontendException

normalize

public void normalize()
Old Pig field schema does not require a tuple schema inside a bag; Now it is required to have that; this method is to fill the gap



Copyright © ${year} The Apache Software Foundation