|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.data.ReadOnceBag
public class ReadOnceBag
This bag does not store the tuples in memory, but has access to an iterator typically provided by Hadoop. Use this when you already have an iterator over tuples and do not want to copy over again to a new bag.
| Nested Class Summary | |
|---|---|
protected class |
ReadOnceBag.ReadOnceBagIterator
|
| Field Summary | |
|---|---|
protected PigNullableWritable |
keyWritable
|
protected Packager |
pkgr
|
protected Iterator<NullableTuple> |
tupIter
|
| Constructor Summary | |
|---|---|
ReadOnceBag(Packager pkgr,
Iterator<NullableTuple> tupIter,
PigNullableWritable keyWritable)
This constructor creates a bag out of an existing iterator of tuples by taking ownership of the iterator and NOT copying the elements of the iterator. |
|
| 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 o)
|
boolean |
equals(Object other)
|
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)
|
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. |
void |
write(DataOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Packager pkgr
protected transient Iterator<NullableTuple> tupIter
protected PigNullableWritable keyWritable
| Constructor Detail |
|---|
public ReadOnceBag(Packager pkgr,
Iterator<NullableTuple> tupIter,
PigNullableWritable keyWritable)
pkg - POPackageLitetupIter - Iteratorkey - Object| Method Detail |
|---|
public long getMemorySize()
Spillable
getMemorySize in interface Spillablepublic long spill()
Spillable
spill in interface Spillablepublic 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 boolean isDistinct()
DataBag
isDistinct in interface DataBagpublic boolean isSorted()
DataBag
isSorted in interface DataBagpublic Iterator<Tuple> iterator()
DataBag
iterator in interface Iterable<Tuple>iterator in interface DataBagpublic void markStale(boolean stale)
DataBag
markStale in interface DataBagstale - Set stale state.public long size()
DataBag
size in interface DataBag
public void readFields(DataInput in)
throws IOException
readFields in interface org.apache.hadoop.io.WritableIOException
public void write(DataOutput out)
throws IOException
write in interface org.apache.hadoop.io.WritableIOExceptionpublic int compareTo(Object o)
compareTo in interface Comparablepublic boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||