org.apache.pig.data
Class SchemaTupleFrontend

java.lang.Object
  extended by org.apache.pig.data.SchemaTupleFrontend

public class SchemaTupleFrontend
extends Object

This class is to be used at job creation time. It provides the API that lets code register Schemas with pig to be generated. It is necessary to register these Schemas and reducers.


Constructor Summary
SchemaTupleFrontend()
           
 
Method Summary
static void copyAllGeneratedToDistributedCache(PigContext pigContext, org.apache.hadoop.conf.Configuration conf)
          This must be called when the code has been generated and the generated code needs to be shipped to the cluster, so that it may be used by the mappers and reducers.
protected static void lazyReset(PigContext pigContext)
          This is a method which caches a PigContext object that has had relevant key values set by SchemaTupleBackend.
static int registerToGenerateIfPossible(Schema udfSchema, boolean isAppendable, SchemaTupleClassGenerator.GenContext context)
          This method "registers" a Schema to be generated.
static void reset()
          This allows the frontend/backend process to be repeated if on the same JVM (as in testing).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaTupleFrontend

public SchemaTupleFrontend()
Method Detail

reset

public static void reset()
This allows the frontend/backend process to be repeated if on the same JVM (as in testing).


registerToGenerateIfPossible

public static int registerToGenerateIfPossible(Schema udfSchema,
                                               boolean isAppendable,
                                               SchemaTupleClassGenerator.GenContext context)
This method "registers" a Schema to be generated. It allows a portions of the code to register a Schema for generation without knowing whether code generation is enabled. A unique ID will be passed back that can be used internally to refer to generated SchemaTuples (such as in the case of serialization and deserialization). The context is necessary to allow the client to restrict where generated code can be used.

Parameters:
udfSchema - This is the Schema of a Tuple that we will potentially generate
isAppendable - This specifies whether or not we want the SchemaTuple to be appendable
context - This is the context in which users should be able to access the SchemaTuple
Returns:
identifier

copyAllGeneratedToDistributedCache

public static void copyAllGeneratedToDistributedCache(PigContext pigContext,
                                                      org.apache.hadoop.conf.Configuration conf)
This must be called when the code has been generated and the generated code needs to be shipped to the cluster, so that it may be used by the mappers and reducers.

Parameters:
pigContext -
conf -

lazyReset

protected static void lazyReset(PigContext pigContext)
This is a method which caches a PigContext object that has had relevant key values set by SchemaTupleBackend. This is necessary because in some cases, multiple cycles of jobs might run in the JVM, but the PigContext object may be shared, so we want to make sure to undo any changes we have made to it.



Copyright © 2007-2012 The Apache Software Foundation