public class IntersectingIterator extends Object implements SortedKeyValueIterator<Key,Value>
Modifier and Type | Class and Description |
---|---|
protected static class |
IntersectingIterator.TermSource |
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.io.Text |
currentDocID |
protected org.apache.hadoop.io.Text |
currentPartition |
protected boolean |
inclusive |
protected static org.apache.log4j.Logger |
log |
protected org.apache.hadoop.io.Text |
nullText |
protected Collection<ByteSequence> |
seekColumnFamilies |
protected Key |
topKey |
protected Value |
value |
Constructor and Description |
---|
IntersectingIterator() |
Modifier and Type | Method and Description |
---|---|
void |
addSource(SortedKeyValueIterator<Key,Value> source,
IteratorEnvironment env,
org.apache.hadoop.io.Text term,
boolean notFlag) |
protected void |
advanceToIntersection() |
protected Key |
buildFollowingPartitionKey(Key key) |
protected Key |
buildKey(org.apache.hadoop.io.Text partition,
org.apache.hadoop.io.Text term) |
protected Key |
buildKey(org.apache.hadoop.io.Text partition,
org.apache.hadoop.io.Text term,
org.apache.hadoop.io.Text docID) |
static boolean[] |
decodeBooleans(String flags)
Deprecated.
since 1.4. To be made protected. Do not interact with flags string directly, just use
setColumnFamilies(IteratorSetting, Text[], boolean[]) . |
protected static org.apache.hadoop.io.Text[] |
decodeColumns(String columns) |
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)
Deprecated.
since 1.4. To be made protected. Do not interact with flags string directly, just use
setColumnFamilies(IteratorSetting, Text[], boolean[]) . |
static String |
encodeColumns(org.apache.hadoop.io.Text[] columns)
Deprecated.
since 1.4. To be made protected. Do not interact with flags string directly, just use
setColumnFamilies(IteratorSetting, Text[], boolean[]) . |
protected org.apache.hadoop.io.Text |
getDocID(Key key) |
protected org.apache.hadoop.io.Text |
getPartition(Key key) |
protected org.apache.hadoop.io.Text |
getTerm(Key key) |
Key |
getTopKey()
Returns top key.
|
Value |
getTopValue()
Returns top value.
|
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.
|
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 void |
setColumnFamilies(IteratorSetting cfg,
org.apache.hadoop.io.Text[] columns)
Encode the columns to be used when iterating.
|
static void |
setColumnFamilies(IteratorSetting cfg,
org.apache.hadoop.io.Text[] columns,
boolean[] notFlags)
Encode columns and NOT flags indicating which columns should be negated (docIDs will be excluded if matching negated columns, instead of included).
|
static String |
stringTopKey(SortedKeyValueIterator<Key,Value> iter) |
protected org.apache.hadoop.io.Text nullText
protected static final org.apache.log4j.Logger log
protected org.apache.hadoop.io.Text currentPartition
protected org.apache.hadoop.io.Text currentDocID
protected Key topKey
protected Value value
protected Collection<ByteSequence> seekColumnFamilies
protected boolean inclusive
protected org.apache.hadoop.io.Text getPartition(Key key)
protected org.apache.hadoop.io.Text getTerm(Key key)
protected org.apache.hadoop.io.Text getDocID(Key key)
protected Key buildKey(org.apache.hadoop.io.Text partition, org.apache.hadoop.io.Text term)
protected Key buildKey(org.apache.hadoop.io.Text partition, org.apache.hadoop.io.Text term, org.apache.hadoop.io.Text docID)
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)
setColumnFamilies(IteratorSetting, Text[], boolean[])
.columns
- public static String encodeBooleans(boolean[] flags)
setColumnFamilies(IteratorSetting, Text[], boolean[])
.flags
- protected static org.apache.hadoop.io.Text[] decodeColumns(String columns)
public static boolean[] decodeBooleans(String flags)
setColumnFamilies(IteratorSetting, Text[], boolean[])
.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<K, V>, java.util.Map<java.lang.String, java.lang.String>, 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 static void setColumnFamilies(IteratorSetting cfg, org.apache.hadoop.io.Text[] columns)
cfg
- columns
- public static void setColumnFamilies(IteratorSetting cfg, org.apache.hadoop.io.Text[] columns, boolean[] notFlags)
cfg
- columns
- notFlags
- Copyright © 2012 The Apache Software Foundation. All Rights Reserved.