org.apache.pig.data
Class SchemaTupleFactory

java.lang.Object
  extended by org.apache.pig.data.SchemaTupleFactory
All Implemented Interfaces:
TupleMaker<SchemaTuple<?>>

public class SchemaTupleFactory
extends Object
implements TupleMaker<SchemaTuple<?>>

This is an implementation of TupleFactory that will instantiate SchemaTuple's. This class has nothing to do with the actual generation of code, and instead simply encapsulates the classes which allow for efficiently creating SchemaTuples.


Constructor Summary
protected SchemaTupleFactory(Class<SchemaTuple<?>> clazz, SchemaTuple.SchemaTupleQuickGenerator<? extends SchemaTuple<?>> generator)
           
 
Method Summary
protected static SchemaTupleFactory getInstance(int id)
          This method is the publicly facing method which returns a SchemaTupleFactory which will generate the SchemaTuple associated with the given identifier.
static SchemaTupleFactory getInstance(Schema s)
           
static SchemaTupleFactory getInstance(Schema s, boolean isAppendable)
           
static SchemaTupleFactory getInstance(Schema s, boolean isAppendable, SchemaTupleClassGenerator.GenContext context)
          This method is the publicly facing method which returns a SchemaTupleFactory which will generate SchemaTuples of the given Schema.
 boolean isFixedSize()
           
static boolean isGeneratable(Schema s)
          This method inspects a Schema to see whether or not a SchemaTuple implementation can be generated for the types present.
 SchemaTuple<?> newTuple()
           
 SchemaTuple<?> newTuple(int size)
           
 Class<SchemaTuple<?>> tupleClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaTupleFactory

protected SchemaTupleFactory(Class<SchemaTuple<?>> clazz,
                             SchemaTuple.SchemaTupleQuickGenerator<? extends SchemaTuple<?>> generator)
Method Detail

isGeneratable

public static boolean isGeneratable(Schema s)
This method inspects a Schema to see whether or not a SchemaTuple implementation can be generated for the types present. Currently, bags and maps are not supported.

Parameters:
s - as Schema
Returns:
boolean type value, true if it is generatable

newTuple

public SchemaTuple<?> newTuple()
Specified by:
newTuple in interface TupleMaker<SchemaTuple<?>>

newTuple

public SchemaTuple<?> newTuple(int size)
Specified by:
newTuple in interface TupleMaker<SchemaTuple<?>>

tupleClass

public Class<SchemaTuple<?>> tupleClass()

isFixedSize

public boolean isFixedSize()

getInstance

protected static SchemaTupleFactory getInstance(int id)
This method is the publicly facing method which returns a SchemaTupleFactory which will generate the SchemaTuple associated with the given identifier. This method is primarily for internal use in cases where the problem SchemaTuple is known based on the identifier associated with it (such as when deserializing).

Parameters:
id - as int, means identifier
Returns:
SchemaTupleFactory which will return SchemaTuple's of the given identifier

getInstance

public static SchemaTupleFactory getInstance(Schema s,
                                             boolean isAppendable,
                                             SchemaTupleClassGenerator.GenContext context)
This method is the publicly facing method which returns a SchemaTupleFactory which will generate SchemaTuples of the given Schema. Note that this method returns null if such a given SchemaTupleFactory does not exist, instead of throwing an error. The GenContext is used to specify the context in which we are requesting a SchemaTupleFactory. This is necessary so that the use of SchemaTuple can be controlled -- it is possible that someone wants a factory that generates code in the context of joins, but wants to disable such use for udfs.

Parameters:
s - the Schema generated
isAppendable - whether or not the SchemaTuple should be appendable
context - the context in which we want a SchemaTupleFactory
Returns:
SchemaTupleFactory which will return SchemaTuple's of the desired Schema

getInstance

public static SchemaTupleFactory getInstance(Schema s,
                                             boolean isAppendable)

getInstance

public static SchemaTupleFactory getInstance(Schema s)


Copyright © 2007-2012 The Apache Software Foundation