|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.data.DefaultAbstractBag
org.apache.pig.data.SortedSpillBag
org.apache.pig.data.InternalSortedBag
public class InternalSortedBag
An ordered collection of Tuples (possibly) with multiples. Data is stored unsorted as it comes in, and only sorted when it is time to dump it to a file or when the first iterator is requested. Experementation found this to be the faster than storing it sorted to begin with. We allow a user defined comparator, but provide a default comparator in cases where the user doesn't specify one. This bag is not registered with SpillableMemoryManager. It calculates the number of tuples to hold in memory and spill pro-actively into files.
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 | |
---|---|
InternalSortedBag()
|
|
InternalSortedBag(Comparator<Tuple> comp)
|
|
InternalSortedBag(int bagCount,
Comparator<Tuple> comp)
|
|
InternalSortedBag(int bagCount,
double percent,
Comparator<Tuple> comp)
|
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. |
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.SortedSpillBag |
---|
proactive_spill |
Methods inherited from class org.apache.pig.data.DefaultAbstractBag |
---|
clear, 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 |
---|
public InternalSortedBag()
public InternalSortedBag(Comparator<Tuple> comp)
public InternalSortedBag(int bagCount, Comparator<Tuple> comp)
public InternalSortedBag(int bagCount, double percent, Comparator<Tuple> comp)
Method Detail |
---|
public void add(Tuple t)
DefaultAbstractBag
add
in interface DataBag
add
in class DefaultAbstractBag
t
- tuple to add.public void addAll(DataBag b)
DefaultAbstractBag
addAll
in interface DataBag
addAll
in class DefaultAbstractBag
b
- bag to add contents of.public void addAll(Collection<Tuple> c)
DefaultAbstractBag
addAll
in class DefaultAbstractBag
c
- Collection to add contents of.public boolean isSorted()
DataBag
public boolean isDistinct()
DataBag
public Iterator<Tuple> iterator()
DataBag
public long spill()
Spillable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |