org.apache.pig.data
Enum SchemaTupleClassGenerator.GenContext

java.lang.Object
  extended by java.lang.Enum<SchemaTupleClassGenerator.GenContext>
      extended by org.apache.pig.data.SchemaTupleClassGenerator.GenContext
All Implemented Interfaces:
Serializable, Comparable<SchemaTupleClassGenerator.GenContext>
Enclosing class:
SchemaTupleClassGenerator

public static enum SchemaTupleClassGenerator.GenContext
extends Enum<SchemaTupleClassGenerator.GenContext>

The GenContext mechanism provides a level of control in where SchemaTupleFactories are used. By attaching a GenContext enum type to the registration of a Schema, the code can express the intent of where a SchemaTupleFactory is intended to be used. In this way, if a load func and a join both involve Tuples of the same Schema, it's possible to use SchemaTupleFactories in one but not in the other.


Nested Class Summary
static interface SchemaTupleClassGenerator.GenContext.GenerateForceLoad
           
static interface SchemaTupleClassGenerator.GenContext.GenerateForeach
           
static interface SchemaTupleClassGenerator.GenContext.GenerateFrJoin
           
static interface SchemaTupleClassGenerator.GenContext.GenerateMergeJoin
           
static interface SchemaTupleClassGenerator.GenContext.GenerateUdf
          These annotations are used to mark a given SchemaTuple with the context in which is was intended to be generated.
 
Enum Constant Summary
FORCE_LOAD
          All registered Schemas will also be registered in one additional context.
FOREACH
          This context is for POForEach.
FR_JOIN
          This context controls whether or not SchemaTuples will be used in FR joins.
MERGE_JOIN
          This context controls whether or not SchemaTuples will be used in merge joins.
UDF
          This context is used in UDF code.
 
Method Summary
 String getAnnotationCanonicalName()
           
 String key()
           
 boolean shouldGenerate(Class clazz)
          Checks the generated class to see if the annotation associated with this enum is present.
 boolean shouldGenerate(org.apache.hadoop.conf.Configuration conf)
          Given a job configuration file, this checks to see if the default value has been overriden.
static SchemaTupleClassGenerator.GenContext valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SchemaTupleClassGenerator.GenContext[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UDF

public static final SchemaTupleClassGenerator.GenContext UDF
This context is used in UDF code. Currently, this is only used for the inputs to UDF's.


FOREACH

public static final SchemaTupleClassGenerator.GenContext FOREACH
This context is for POForEach. This will use the expected output of a ForEach to return a typed Tuple.


FR_JOIN

public static final SchemaTupleClassGenerator.GenContext FR_JOIN
This context controls whether or not SchemaTuples will be used in FR joins. Currently, they will be used in the HashMap that FR Joins construct.


MERGE_JOIN

public static final SchemaTupleClassGenerator.GenContext MERGE_JOIN
This context controls whether or not SchemaTuples will be used in merge joins.


FORCE_LOAD

public static final SchemaTupleClassGenerator.GenContext FORCE_LOAD
All registered Schemas will also be registered in one additional context. This context will allow users to "force" the load of a SchemaTupleFactory if one is present in any context.

Method Detail

values

public static SchemaTupleClassGenerator.GenContext[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SchemaTupleClassGenerator.GenContext c : SchemaTupleClassGenerator.GenContext.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SchemaTupleClassGenerator.GenContext valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

key

public String key()

getAnnotationCanonicalName

public String getAnnotationCanonicalName()

shouldGenerate

public boolean shouldGenerate(Class clazz)
Checks the generated class to see if the annotation associated with this enum is present.

Parameters:
clazz -
Returns:
boolean type value

shouldGenerate

public boolean shouldGenerate(org.apache.hadoop.conf.Configuration conf)
Given a job configuration file, this checks to see if the default value has been overriden.

Parameters:
conf -
Returns:
boolean type value


Copyright © 2007-2012 The Apache Software Foundation