org.apache.pig.data
Class AccumulativeBag

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

public class AccumulativeBag
extends Object
implements DataBag

See Also:
Serialized Form

Constructor Summary
AccumulativeBag(AccumulativeTupleBuffer buffer, int index)
           
 
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 other)
           
 long getMemorySize()
          Requests that an object return an estimate of its in memory size.
 AccumulativeTupleBuffer getTuplebuffer()
           
 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 datainput)
           
 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 dataoutput)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccumulativeBag

public AccumulativeBag(AccumulativeTupleBuffer buffer,
                       int index)
Method Detail

add

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

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

addAll

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

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

clear

public void clear()
Description copied from interface: DataBag
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

isDistinct

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

Specified by:
isDistinct in interface DataBag
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.

Specified by:
isSorted in interface DataBag
Returns:
true if this is a sorted data bag, false otherwise.

getTuplebuffer

public AccumulativeTupleBuffer getTuplebuffer()

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.

Specified by:
iterator in interface Iterable<Tuple>
Specified by:
iterator in interface DataBag
Returns:
tuple iterator

markStale

public void markStale(boolean stale)
Description copied from interface: DataBag
This is used by FuncEvalSpec.FakeDataBag.

Specified by:
markStale in interface DataBag
Parameters:
stale - Set stale state.

size

public long size()
Description copied from interface: DataBag
Get the number of elements in the bag, both in memory and on disk.

Specified by:
size in interface DataBag
Returns:
number of elements in the bag

getMemorySize

public long getMemorySize()
Description copied from interface: Spillable
Requests that an object return an estimate of its in memory size.

Specified by:
getMemorySize in interface Spillable
Returns:
estimated in memory size.

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.

Specified by:
spill in interface Spillable
Returns:
number of objects spilled.

readFields

public void readFields(DataInput datainput)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput dataoutput)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © ${year} The Apache Software Foundation