- All Superinterfaces:
- All Known Implementing Classes:
DataBag provides an Iterator interface, that allows callers to read through the contents. The iterators are aware of the data spilling. They have to be able to handle reading from files.
The DataBag interface assumes that all data is written before any is read. That is, a DataBag cannot be used as a queue. If data is written after data is read, the results are undefined. This condition is not checked on each add or read, for reasons of speed. Caveat emptor.
DataBags come in several types, default, sorted, and distinct. The type must be chosen up front, there is no way to convert a bag on the fly. Default data bags do not guarantee any particular order of retrieval for the tuples and may contain duplicate tuples. Sorted data bags guarantee that tuples will be retrieved in order, where "in order" is defined either by the default comparator for Tuple or the comparator provided by the caller when the bag was created. Sorted bags may contain duplicates. Distinct bags do not guarantee any particular order of retrieval, but do guarantee that they will not contain duplicate tuples.
Inspired by Apache Pig
- See Also:
Method SummaryModifier and TypeMethodDescription
voidAdd a tuple to the bag.
default voidAdd contents of an Iterable to the bag.
default voidAdd contents of an Iterator to the bag.
booleanFind out if the bag is distinct.
isSorted()Find out if the bag is sorted.
size()Get the number of elements in the bag, both in memory and on disk.
Methods inherited from interface org.apache.jena.atlas.lib.Closeable
Methods inherited from interface org.apache.jena.atlas.lib.Sink
sizelong size()Get the number of elements in the bag, both in memory and on disk.
- number of elements in the bag
isSortedboolean isSorted()Find out if the bag is sorted.
- true if this is a sorted data bag, false otherwise.
isDistinctboolean isDistinct()Find out if the bag is distinct.
- true if the bag is a distinct bag, false otherwise.
(T t)Add a tuple to the bag.
t- tuple to add.
addAllAdd contents of an Iterable to the bag.
it- iterable to add contents of.
addAllAdd contents of an Iterator to the bag.
it- iterator to add contents of.