public class ReadOnceBag extends java.lang.Object implements DataBag
Modifier and Type | Class and Description |
---|---|
protected class |
ReadOnceBag.ReadOnceBagIterator |
Modifier and Type | Field and Description |
---|---|
protected PigNullableWritable |
keyWritable |
protected Packager |
pkgr |
protected java.util.Iterator<NullableTuple> |
tupIter |
Constructor and Description |
---|
ReadOnceBag() |
ReadOnceBag(Packager pkgr,
java.util.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.
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.Object o) |
boolean |
equals(java.lang.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.
|
java.util.Iterator<Tuple> |
iterator()
Get an iterator to the bag.
|
void |
markStale(boolean stale)
This is used by FuncEvalSpec.FakeDataBag.
|
void |
readFields(java.io.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(java.io.DataOutput out) |
protected Packager pkgr
protected transient java.util.Iterator<NullableTuple> tupIter
protected PigNullableWritable keyWritable
public ReadOnceBag()
public ReadOnceBag(Packager pkgr, java.util.Iterator<NullableTuple> tupIter, PigNullableWritable keyWritable)
pkg
- POPackageLitetupIter
- Iteratorkey
- Objectpublic long getMemorySize()
Spillable
getMemorySize
in interface Spillable
public long spill()
Spillable
public void addAll(DataBag b)
DataBag
public void clear()
DataBag
public boolean isDistinct()
DataBag
isDistinct
in interface DataBag
public boolean isSorted()
DataBag
public java.util.Iterator<Tuple> iterator()
DataBag
public void markStale(boolean stale)
DataBag
public long size()
DataBag
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2007-2017 The Apache Software Foundation