|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.accumulo.examples.wikisearch.iterator.AndIterator
public class AndIterator
Nested Class Summary | |
---|---|
protected static class |
AndIterator.TermSource
Used in representing a Term that is intersected on. |
Field Summary | |
---|---|
static String |
columnFamiliesOptionName
|
protected byte[] |
emptyByteArray
|
protected static org.apache.log4j.Logger |
log
|
static String |
notFlagsOptionName
|
protected org.apache.hadoop.io.Text |
nullText
|
static String |
termValuesOptionName
|
protected Value |
value
|
Constructor Summary | |
---|---|
AndIterator()
Empty default constructor |
|
AndIterator(AndIterator other,
IteratorEnvironment env)
|
Method Summary | |
---|---|
void |
addSource(SortedKeyValueIterator<Key,Value> source,
IteratorEnvironment env,
org.apache.hadoop.io.Text term,
boolean notFlag)
|
void |
addSource(SortedKeyValueIterator<Key,Value> source,
IteratorEnvironment env,
org.apache.hadoop.io.Text dataLocation,
org.apache.hadoop.io.Text term,
boolean notFlag)
|
protected void |
advanceToIntersection()
|
protected Key |
buildFollowingPartitionKey(Key key)
Return the key that directly follows the given key |
protected Key |
buildKey(org.apache.hadoop.io.Text row,
org.apache.hadoop.io.Text dataLocation)
Build a key from the given row and dataLocation |
protected Key |
buildKey(org.apache.hadoop.io.Text row,
org.apache.hadoop.io.Text dataLocation,
org.apache.hadoop.io.Text term)
Build a key from the given row, dataLocation, and term |
static boolean[] |
decodeBooleans(String flags)
Decode the encoded NOT flags into a boolean array |
static org.apache.hadoop.io.Text[] |
decodeColumns(String columns)
Decode the encoded columns into a Text array |
static org.apache.hadoop.io.Text[] |
decodeTermValues(String terms)
Decode the encoded terms into a Text array |
SortedKeyValueIterator<Key,Value> |
deepCopy(IteratorEnvironment env)
Creates a deep copy of this iterator as though seek had not yet been called. |
static String |
encodeBooleans(boolean[] flags)
Encode an array of booleans denoted which columns are NOT'ed |
static String |
encodeColumns(org.apache.hadoop.io.Text[] columns)
Encode a Text array of all the columns to intersect on |
static String |
encodeTermValues(org.apache.hadoop.io.Text[] terms)
Encode a Text array of all of the terms to intersect on. |
protected org.apache.hadoop.io.Text |
getDataLocation(Key key)
Returns the given key's dataLocation |
protected org.apache.hadoop.io.Text |
getDocID(Key key)
Returns the given key's DocID |
protected org.apache.hadoop.io.Text |
getPartition(Key key)
|
protected org.apache.hadoop.io.Text |
getTerm(Key key)
Returns the given key's term |
Key |
getTopKey()
Returns top key. |
Value |
getTopValue()
Returns top value. |
protected String |
getUID(Key key)
Returns the given key's UID |
boolean |
hasTop()
Returns true if the iterator has more elements. |
void |
init(SortedKeyValueIterator<Key,Value> source,
Map<String,String> options,
IteratorEnvironment env)
Initializes the iterator. |
boolean |
jump(Key jumpKey)
|
void |
next()
Advances to the next K,V pair. |
void |
seek(Range range,
Collection<ByteSequence> seekColumnFamilies,
boolean inclusive)
Seeks to the first key in the Range, restricting the resulting K,V pairs to those with the specified columns. |
static String |
stringTopKey(SortedKeyValueIterator<Key,Value> iter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger log
protected org.apache.hadoop.io.Text nullText
protected final byte[] emptyByteArray
protected Value value
public static final String columnFamiliesOptionName
public static final String termValuesOptionName
public static final String notFlagsOptionName
Constructor Detail |
---|
public AndIterator()
public AndIterator(AndIterator other, IteratorEnvironment env)
Method Detail |
---|
protected org.apache.hadoop.io.Text getPartition(Key key)
protected org.apache.hadoop.io.Text getDataLocation(Key key)
key
-
protected org.apache.hadoop.io.Text getTerm(Key key)
key
-
protected org.apache.hadoop.io.Text getDocID(Key key)
key
-
protected String getUID(Key key)
key
-
protected Key buildKey(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text dataLocation)
row
- The desired rowdataLocation
- The desired dataLocation
protected Key buildKey(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text dataLocation, org.apache.hadoop.io.Text term)
row
- The desired rowdataLocation
- The desired dataLocationterm
- The desired term
protected Key buildFollowingPartitionKey(Key key)
key
- The key who will be directly before the returned key
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env)
SortedKeyValueIterator
deepCopy
in interface SortedKeyValueIterator<Key,Value>
env
- IteratorEnvironment environment in which iterator is being run.
public Key getTopKey()
SortedKeyValueIterator
getTopKey
in interface SortedKeyValueIterator<Key,Value>
public Value getTopValue()
SortedKeyValueIterator
getTopValue
in interface SortedKeyValueIterator<Key,Value>
public boolean hasTop()
SortedKeyValueIterator
hasTop
in interface SortedKeyValueIterator<Key,Value>
public void next() throws IOException
SortedKeyValueIterator
next
in interface SortedKeyValueIterator<Key,Value>
IOException
- if an I/O error occurs.protected void advanceToIntersection() throws IOException
IOException
public static String stringTopKey(SortedKeyValueIterator<Key,Value> iter)
public static String encodeColumns(org.apache.hadoop.io.Text[] columns)
Text
array of all the columns to intersect on
columns
- The columns to be encoded
public static String encodeTermValues(org.apache.hadoop.io.Text[] terms)
Text
array of all of the terms to intersect on. The terms should match the columns in a one-to-one manner
terms
- The terms to be encoded
public static String encodeBooleans(boolean[] flags)
booleans
denoted which columns are NOT'ed
flags
- The array of NOTs
public static org.apache.hadoop.io.Text[] decodeColumns(String columns)
Text
array
columns
- The Base64 encoded String of the columns
public static org.apache.hadoop.io.Text[] decodeTermValues(String terms)
Text
array
terms
- The Base64 encoded String of the terms
public static boolean[] decodeBooleans(String flags)
boolean
array
flags
-
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException
SortedKeyValueIterator
init
in interface SortedKeyValueIterator<Key,Value>
source
- SortedKeyValueIterator source to read data from.options
- Map map of string option names to option values.env
- IteratorEnvironment environment in which iterator is being run.
IOException
- unused.public void seek(Range range, Collection<ByteSequence> seekColumnFamilies, boolean inclusive) throws IOException
SortedKeyValueIterator
SortedKeyValueIterator.init(org.apache.accumulo.core.iterators.SortedKeyValueIterator, java.util.Map, org.apache.accumulo.core.iterators.IteratorEnvironment)
is called.
Iterators that examine groups of adjacent key/value pairs (e.g. rows) to determine their top key and value should be sure that they properly handle a seek
to a key in the middle of such a group (e.g. the middle of a row). Even if the client always seeks to a range containing an entire group (a,c), the tablet
server could send back a batch of entries corresponding to (a,b], then reseek the iterator to range (b,c) when the scan is continued.
seek
in interface SortedKeyValueIterator<Key,Value>
range
- Range of keys to iterate over.seekColumnFamilies
- Collection of column families to include or exclude.inclusive
- boolean that indicates whether to include (true) or exclude (false) column families.
IOException
- if an I/O error occurs.public void addSource(SortedKeyValueIterator<Key,Value> source, IteratorEnvironment env, org.apache.hadoop.io.Text term, boolean notFlag)
public void addSource(SortedKeyValueIterator<Key,Value> source, IteratorEnvironment env, org.apache.hadoop.io.Text dataLocation, org.apache.hadoop.io.Text term, boolean notFlag)
public boolean jump(Key jumpKey) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |