org.apache.pig.data
Class BagFactory

java.lang.Object
  extended by org.apache.pig.data.BagFactory
Direct Known Subclasses:
DefaultBagFactory

public abstract class BagFactory
extends Object

Factory for constructing different types of bags. This class is abstract so that users can override the bag factory if they desire to provide their own that returns their implementation of a bag. If the property pig.data.bag.factory.name is set to a class name and pig.data.bag.factory.jar is set to a URL pointing to a jar that contains the above named class, then getInstance() will create a a instance of the named class using the indicatd jar. Otherwise, it will create an instance of DefaultBagFactory.


Constructor Summary
protected BagFactory()
           
 
Method Summary
static BagFactory getInstance()
          Get a reference to the singleton factory.
abstract  DataBag newDefaultBag()
          Get a default (unordered, not distinct) data bag.
abstract  DataBag newDefaultBag(List<Tuple> listOfTuples)
          Get a default (unordered, not distinct) data bag from an existing list of tuples.
abstract  DataBag newDistinctBag()
          Get a distinct data bag.
abstract  DataBag newSortedBag(Comparator<Tuple> comp)
          Get a sorted data bag.
protected  void registerBag(DataBag b)
           
static void resetSelf()
          Provided for testing purposes only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BagFactory

protected BagFactory()
Method Detail

getInstance

public static BagFactory getInstance()
Get a reference to the singleton factory.


newDefaultBag

public abstract DataBag newDefaultBag()
Get a default (unordered, not distinct) data bag.


newDefaultBag

public abstract DataBag newDefaultBag(List<Tuple> listOfTuples)
Get a default (unordered, not distinct) data bag from an existing list of tuples.


newSortedBag

public abstract DataBag newSortedBag(Comparator<Tuple> comp)
Get a sorted data bag.

Parameters:
comp - Comparator that controls how the data is sorted. If null, default comparator will be used.

newDistinctBag

public abstract DataBag newDistinctBag()
Get a distinct data bag.


registerBag

protected void registerBag(DataBag b)

resetSelf

public static void resetSelf()
Provided for testing purposes only. This function should never be called by anybody but the unit tests.



Copyright © ${year} The Apache Software Foundation