|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.data.NonSpillableDataBag
public class NonSpillableDataBag
An unordered collection of Tuples (possibly) with multiples. The tuples are stored in an ArrayList, since there is no concern for order or distinctness. The implicit assumption is that the user of this class is storing only those many tuples as will fit in memory - no spilling will be done on this bag to disk.
| Constructor Summary | |
|---|---|
NonSpillableDataBag()
|
|
NonSpillableDataBag(int tupleCount)
Use this constructor if you know upfront how many tuples you are going to put in this bag. |
|
NonSpillableDataBag(List<Tuple> listOfTuples)
This constructor creates a bag out of an existing list of tuples by taking ownership of the list and NOT copying the contents of the list. |
|
| Method Summary | |
|---|---|
void |
add(Tuple t)
Add a tuple 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. |
int |
compareTo(Object other)
|
boolean |
equals(Object obj)
|
long |
getMemorySize()
Requests that an object return an estimate of its in memory size. |
int |
hashCode()
|
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. |
void |
markStale(boolean stale)
This is used by FuncEvalSpec.FakeDataBag. |
void |
readFields(DataInput in)
Read a bag from disk. |
protected void |
reportProgress()
Report progress to HDFS. |
long |
size()
Get the number of elements in the bag, both in memory and on disk. |
long |
spill()
Instructs an object to spill whatever it can to disk and release references to any data structures it spills. |
String |
toString()
Write the bag into a string. |
void |
write(DataOutput out)
Write a bag's contents to disk. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NonSpillableDataBag()
public NonSpillableDataBag(int tupleCount)
tupleCount - public NonSpillableDataBag(List<Tuple> listOfTuples)
listOfTuples - List| Method Detail |
|---|
public boolean isSorted()
DataBag
isSorted in interface DataBagpublic boolean isDistinct()
DataBag
isDistinct in interface DataBagpublic Iterator<Tuple> iterator()
DataBag
iterator in interface Iterable<Tuple>iterator in interface DataBagprotected void reportProgress()
public void add(Tuple t)
DataBag
add in interface DataBagt - tuple to add.public void addAll(DataBag b)
DataBag
addAll in interface DataBagb - bag to add contents of.public void clear()
DataBag
clear in interface DataBagpublic void markStale(boolean stale)
DataBag
markStale in interface DataBagstale - Set stale state.public long size()
DataBag
size in interface DataBagpublic long getMemorySize()
Spillable
getMemorySize in interface Spillablepublic long spill()
Spillable
spill in interface Spillable
public void write(DataOutput out)
throws IOException
write in interface org.apache.hadoop.io.Writableout - DataOutput to write data to.
IOException - (passes it on from underlying calls).
public void readFields(DataInput in)
throws IOException
readFields in interface org.apache.hadoop.io.Writablein - DataInput to read data from.
IOException - (passes it on from underlying calls).public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic int compareTo(Object other)
compareTo in interface Comparablepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||