You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2012/07/02 20:51:37 UTC
svn commit: r1356400 -
/accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java
Author: ecn
Date: Mon Jul 2 18:51:36 2012
New Revision: 1356400
URL: http://svn.apache.org/viewvc?rev=1356400&view=rev
Log:
ACCUMULO-665: AndIterator needs to reset column families on its source iterators to take advantage of locality groups
Modified:
accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java
Modified: accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java?rev=1356400&r1=1356399&r2=1356400&view=diff
==============================================================================
--- accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java (original)
+++ accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java Mon Jul 2 18:51:36 2012
@@ -17,9 +17,11 @@
package org.apache.accumulo.examples.wikisearch.iterator;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
+import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.PartialKey;
@@ -86,7 +88,8 @@ public class AndIterator implements Sort
}
/*
- * | Row | Column Family | Column Qualifier | Value | {RowID} | {dataLocation} | {term}\0{dataType}\0{UID} | Empty
+ * | Row | Column Family | Column Qualifier | Value
+ * | {RowID} | {dataLocation} | {term}\0{dataType}\0{UID} | Empty
*/
protected Text getPartition(Key key) {
return key.getRow();
@@ -778,21 +781,24 @@ public class AndIterator implements Sort
// seek each of the sources to the right column family within the row given by key
for (int i = 0; i < sourcesCount; i++) {
Key sourceKey;
+ Text dataLocation = (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation;
+ Collection<ByteSequence> columnFamilies = new ArrayList<ByteSequence>();
+ columnFamilies.add(new ArrayByteSequence(dataLocation.getBytes(), 0, dataLocation.getLength()));
if (range.getStartKey() != null) {
// Build a key with the DocID if one is given
- if (range.getStartKey().getColumnFamily() != null) {
- sourceKey = buildKey(getPartition(range.getStartKey()), (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation,
+ if (range.getStartKey().getColumnFamily() != null) {
+ sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation,
(sources[i].term == null) ? nullText : new Text(sources[i].term + "\0" + range.getStartKey().getColumnFamily()));
} // Build a key with just the term.
else {
- sourceKey = buildKey(getPartition(range.getStartKey()), (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation,
+ sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation,
(sources[i].term == null) ? nullText : sources[i].term);
}
if (!range.isStartKeyInclusive())
sourceKey = sourceKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL);
- sources[i].iter.seek(new Range(sourceKey, true, null, false), seekColumnFamilies, inclusive);
+ sources[i].iter.seek(new Range(sourceKey, true, null, false), columnFamilies, inclusive);
} else {
- sources[i].iter.seek(range, seekColumnFamilies, inclusive);
+ sources[i].iter.seek(range, columnFamilies, inclusive);
}
}