org.apache.pig.data
Class InternalCachedBag

java.lang.Object
  extended by org.apache.pig.data.DefaultAbstractBag
      extended by org.apache.pig.data.InternalCachedBag
All Implemented Interfaces:
Serializable, Comparable, Iterable<Tuple>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable, DataBag, Spillable

public class InternalCachedBag
extends DefaultAbstractBag

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.pig.data.DefaultAbstractBag
DefaultAbstractBag.BagDelimiterTuple, DefaultAbstractBag.EndBag, DefaultAbstractBag.StartBag
 
Field Summary
 
Fields inherited from class org.apache.pig.data.DefaultAbstractBag
endBag, MAX_SPILL_FILES, mContents, mLastContentsSize, mMemSize, mSize, mSpillFiles, startBag
 
Constructor Summary
InternalCachedBag()
           
InternalCachedBag(int bagCount)
           
InternalCachedBag(int bagCount, float percent)
           
 
Method Summary
 void add(Tuple t)
          Add a tuple to the bag.
 void addAll(Collection<Tuple> c)
          Add contents of a container to the bag.
 void addAll(DataBag b)
          Add contents of a bag to the bag.
 void clear()
          Clear out the contents of the bag, both on disk and in memory.
 boolean isDistinct()
          Find out if the bag is distinct.
 boolean isSorted()
          Find out if the bag is sorted.
 Iterator<Tuple> iterator()
          Get an iterator to the bag.
 long spill()
          Instructs an object to spill whatever it can to disk and release references to any data structures it spills.
 
Methods inherited from class org.apache.pig.data.DefaultAbstractBag
compareTo, equals, getMemorySize, getSpillFile, hashCode, incSpillCount, incSpillCount, markStale, readFields, reportProgress, size, toString, warn, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InternalCachedBag

public InternalCachedBag()

InternalCachedBag

public InternalCachedBag(int bagCount)

InternalCachedBag

public InternalCachedBag(int bagCount,
                         float percent)
Method Detail

add

public void add(Tuple t)
Description copied from class: DefaultAbstractBag
Add a tuple to the bag.

Specified by:
add in interface DataBag
Overrides:
add in class DefaultAbstractBag
Parameters:
t - tuple to add.

addAll

public void addAll(DataBag b)
Description copied from class: DefaultAbstractBag
Add contents of a bag to the bag.

Specified by:
addAll in interface DataBag
Overrides:
addAll in class DefaultAbstractBag
Parameters:
b - bag to add contents of.

addAll

public void addAll(Collection<Tuple> c)
Description copied from class: DefaultAbstractBag
Add contents of a container to the bag.

Overrides:
addAll in class DefaultAbstractBag
Parameters:
c - Collection to add contents of.

clear

public void clear()
Description copied from class: DefaultAbstractBag
Clear out the contents of the bag, both on disk and in memory. Any attempts to read after this is called will produce undefined results.

Specified by:
clear in interface DataBag
Overrides:
clear in class DefaultAbstractBag

isDistinct

public boolean isDistinct()
Description copied from interface: DataBag
Find out if the bag is distinct.

Returns:
true if the bag is a distinct bag, false otherwise.

isSorted

public boolean isSorted()
Description copied from interface: DataBag
Find out if the bag is sorted.

Returns:
true if this is a sorted data bag, false otherwise.

iterator

public Iterator<Tuple> iterator()
Description copied from interface: DataBag
Get an iterator to the bag. For default and distinct bags, no particular order is guaranteed. For sorted bags the order is guaranteed to be sorted according to the provided comparator.

Returns:
tuple iterator

spill

public long spill()
Description copied from interface: Spillable
Instructs an object to spill whatever it can to disk and release references to any data structures it spills.

Returns:
number of objects spilled.


Copyright © ${year} The Apache Software Foundation