incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1207970 - in /incubator/accumulo/branches/1.4: docs/examples/ src/core/src/main/java/org/apache/accumulo/core/iterators/ src/core/src/main/java/org/apache/accumulo/core/iterators/user/ src/core/src/test/java/org/apache/accumulo/core/iterat...
Date Tue, 29 Nov 2011 16:58:43 GMT
Author: billie
Date: Tue Nov 29 16:58:41 2011
New Revision: 1207970

URL: http://svn.apache.org/viewvc?rev=1207970&view=rev
Log:
ACCUMULO-167 deprecated things, added javadocs for intersecting iterators

Modified:
    incubator/accumulo/branches/1.4/docs/examples/README.shard
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/FamilyIntersectingIterator.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilteringIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/IntersectingIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExIteratorTest.java

Modified: incubator/accumulo/branches/1.4/docs/examples/README.shard
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/docs/examples/README.shard?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/docs/examples/README.shard (original)
+++ incubator/accumulo/branches/1.4/docs/examples/README.shard Tue Nov 29 16:58:41 2011
@@ -50,7 +50,7 @@ The following command queries the index 
     /local/username/workspace/accumulo/src/server/src/test/java/accumulo/server/util/DefaultMapTest.java
     /local/username/workspace/accumulo/src/server/src/test/java/accumulo/server/tabletserver/InMemoryMapTest.java
 
-Inorder to run ContinuousQuery, we need to run Reverse.java to populate doc2term
+In order to run ContinuousQuery, we need to run Reverse.java to populate doc2term.
 
     $ ./bin/accumulo org.apache.accumulo.examples.shard.Reverse instance zookeepers shard
doc2term username password
 

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/FamilyIntersectingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/FamilyIntersectingIterator.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/FamilyIntersectingIterator.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/FamilyIntersectingIterator.java
Tue Nov 29 16:58:41 2011
@@ -31,6 +31,21 @@ import org.apache.accumulo.core.data.Val
 import org.apache.accumulo.core.iterators.user.IntersectingIterator;
 import org.apache.hadoop.io.Text;
 
+/**
+ * This iterator facilitates document-partitioned indexing. It is an example of extending
the IntersectingIterator to customize the placement of the term and
+ * docID. It expects a table structure of the following form:
+ * 
+ * row: shardID, colfam: docColf\0type, colqual: docID, value: doc
+ * 
+ * row: shardID, colfam: indexColf, colqual: term\0type\0docID\0info, value: (empty)
+ * 
+ * When you configure this iterator with a set of terms, it will return only the docIDs and
docs that appear with all of the specified terms. The result will
+ * have the following form:
+ * 
+ * row: shardID, colfam: indexColf, colqual: type\0docID\0info, value: doc
+ * 
+ * This iterator is commonly used with BatchScanner or AccumuloInputFormat, to parallelize
the search over all shardIDs.
+ */
 public class FamilyIntersectingIterator extends IntersectingIterator {
   public static final Text DEFAULT_INDEX_COLF = new Text("i");
   public static final Text DEFAULT_DOC_COLF = new Text("e");

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
Tue Nov 29 16:58:41 2011
@@ -33,6 +33,20 @@ import org.apache.commons.codec.binary.B
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 
+/**
+ * This iterator facilitates document-partitioned indexing. It expects a table structure
of the following form:
+ * 
+ * row: shardID, colfam: term, colqual: docID
+ * 
+ * When you configure this iterator with a set of terms (column families), it will return
only the docIDs that appear with all of the specified terms. The
+ * result will have an empty column family, as follows:
+ * 
+ * row: shardID, colfam: (empty), colqual: docID
+ * 
+ * This iterator is commonly used with BatchScanner or AccumuloInputFormat, to parallelize
the search over all shardIDs.
+ * 
+ * README.shard in docs/examples shows an example of using the IntersectingIterator.
+ */
 public class IntersectingIterator implements SortedKeyValueIterator<Key,Value> {
   
   protected Text nullText = new Text();
@@ -364,8 +378,13 @@ public class IntersectingIterator implem
   public static final String columnFamiliesOptionName = "columnFamilies";
   public static final String notFlagOptionName = "notFlag";
   
-  // to be made private
-  // @see setColumnFamilies
+  /**
+   * to be made protected
+   * 
+   * @param columns
+   * @return encoded columns
+   * @deprecated since 1.4 {@link #setColumnFamilies(IteratorSetting, Text[] columns)}
+   */
   public static String encodeColumns(Text[] columns) {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < columns.length; i++) {
@@ -375,6 +394,13 @@ public class IntersectingIterator implem
     return sb.toString();
   }
   
+  /**
+   * to be made protected
+   * 
+   * @param flags
+   * @return encoded flags
+   * @deprecated since 1.4 {@link #setColumnFamilies(IteratorSetting, Text[] columns, boolean[]
flags)}
+   */
   public static String encodeBooleans(boolean[] flags) {
     byte[] bytes = new byte[flags.length];
     for (int i = 0; i < flags.length; i++) {
@@ -386,7 +412,7 @@ public class IntersectingIterator implem
     return new String(Base64.encodeBase64(bytes));
   }
   
-  private static Text[] decodeColumns(String columns) {
+  protected static Text[] decodeColumns(String columns) {
     String[] columnStrings = columns.split("\n");
     Text[] columnTexts = new Text[columnStrings.length];
     for (int i = 0; i < columnStrings.length; i++) {
@@ -395,6 +421,13 @@ public class IntersectingIterator implem
     return columnTexts;
   }
   
+  /**
+   * to be made protected
+   * 
+   * @param flags
+   * @return decoded flags
+   * @deprecated since 1.4
+   */
   public static boolean[] decodeBooleans(String flags) {
     // return null of there were no flags
     if (flags == null)
@@ -507,4 +540,18 @@ public class IntersectingIterator implem
   public static void setColumnFamilies(IteratorSetting cfg, Text[] columns) {
     cfg.addOption(IntersectingIterator.columnFamiliesOptionName, IntersectingIterator.encodeColumns(columns));
   }
-}
\ No newline at end of file
+  
+  /**
+   * Encode columns and NOT flags indicating which columns should be negated (docIDs will
be excluded if matching negated columns, instead of included).
+   * 
+   * @param cfg
+   * @param columns
+   * @param notFlags
+   */
+  public static void setColumnFamilies(IteratorSetting cfg, Text[] columns, boolean[] notFlags)
{
+    if (columns.length != notFlags.length)
+      throw new IllegalArgumentException("columns and notFlags arrays must be the same length");
+    setColumnFamilies(cfg, columns);
+    cfg.addOption(IntersectingIterator.notFlagOptionName, IntersectingIterator.encodeBooleans(notFlags));
+  }
+}

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
Tue Nov 29 16:58:41 2011
@@ -19,15 +19,14 @@ package org.apache.accumulo.core.iterato
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Random;
 import java.util.TreeMap;
 
 import junit.framework.TestCase;
 
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
@@ -65,11 +64,20 @@ public class FamilyIntersectingIteratorT
   static float hitRatio = 0.1f;
   
   private synchronized static TreeMap<Key,Value> createSortedMap(int numRows, int numDocsPerRow,
Text[] columnFamilies, Text[] otherColumnFamilies,
-      HashSet<Text> docs) {
+      HashSet<Text> docs, Text[] negatedColumns) {
     StringBuilder sb = new StringBuilder();
     Random r = new Random();
     Value v = new Value(new byte[0]);
     TreeMap<Key,Value> map = new TreeMap<Key,Value>();
+    boolean[] negateMask = new boolean[columnFamilies.length];
+    
+    for (int i = 0; i < columnFamilies.length; i++) {
+      negateMask[i] = false;
+      if (negatedColumns.length > 0)
+        for (Text ng : negatedColumns)
+          if (columnFamilies[i].equals(ng))
+            negateMask[i] = true;
+    }
     for (int i = 0; i < numRows; i++) {
       Text row = new Text(String.format("%06d", i));
       for (int startDocID = docid; docid - startDocID < numDocsPerRow; docid++) {
@@ -79,9 +87,9 @@ public class FamilyIntersectingIteratorT
         Text doc = new Text("type");
         doc.append(nullByte, 0, 1);
         doc.append(String.format("%010d", docid).getBytes(), 0, 10);
-        for (Text cf : columnFamilies) {
+        for (int j = 0; j < columnFamilies.length; j++) {
           if (r.nextFloat() < hitRatio) {
-            Text colq = new Text(cf);
+            Text colq = new Text(columnFamilies[j]);
             colq.append(nullByte, 0, 1);
             colq.append(doc.getBytes(), 0, doc.getLength());
             colq.append(nullByte, 0, 1);
@@ -89,9 +97,12 @@ public class FamilyIntersectingIteratorT
             Key k = new Key(row, FamilyIntersectingIterator.DEFAULT_INDEX_COLF, colq);
             map.put(k, v);
             sb.append(" ");
-            sb.append(cf);
+            sb.append(columnFamilies[j]);
+            if (negateMask[j])
+              docHits = false;
           } else {
-            docHits = false;
+            if (!negateMask[j])
+              docHits = false;
           }
         }
         if (docHits) {
@@ -122,10 +133,16 @@ public class FamilyIntersectingIteratorT
   
   private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
       Text[] otherColumnFamilies, HashSet<Text> docs) throws IOException {
+    Text nullText[] = new Text[0];
+    return createIteratorStack(numRows, numDocsPerRow, columnFamilies, otherColumnFamilies,
docs, nullText);
+  }
+  
+  private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
+      Text[] otherColumnFamilies, HashSet<Text> docs, Text[] negatedColumns) throws
IOException {
     // write a map file
     trf.openWriter(false);
     
-    TreeMap<Key,Value> inMemoryMap = createSortedMap(numRows, numDocsPerRow, columnFamilies,
otherColumnFamilies, docs);
+    TreeMap<Key,Value> inMemoryMap = createSortedMap(numRows, numDocsPerRow, columnFamilies,
otherColumnFamilies, docs, negatedColumns);
     trf.writer.startNewLocalityGroup("docs", RFileTest.ncfs(docColf.toString()));
     for (Entry<Key,Value> entry : inMemoryMap.entrySet()) {
       if (entry.getKey().getColumnFamily().equals(docColf))
@@ -171,10 +188,10 @@ public class FamilyIntersectingIteratorT
     hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
     SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(FamilyIntersectingIterator.columnFamiliesOptionName, FamilyIntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, FamilyIntersectingIterator.class);
+    FamilyIntersectingIterator.setColumnFamilies(is, columnFamilies);
     FamilyIntersectingIterator iter = new FamilyIntersectingIterator();
-    iter.init(source, options, env);
+    iter.init(source, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -185,7 +202,7 @@ public class FamilyIntersectingIteratorT
       // System.out.println(iter.getDocID(k));
       
       assertTrue(docs.contains(iter.getDocID(k)));
-      assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k)));
+      assertTrue(new String(v.get()).endsWith(" docID=" + iter.getDocID(k)));
       
       iter.next();
     }
@@ -207,10 +224,10 @@ public class FamilyIntersectingIteratorT
     hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
     SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(FamilyIntersectingIterator.columnFamiliesOptionName, FamilyIntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, FamilyIntersectingIterator.class);
+    FamilyIntersectingIterator.setColumnFamilies(is, columnFamilies);
     FamilyIntersectingIterator iter = new FamilyIntersectingIterator();
-    iter.init(source, options, env);
+    iter.init(source, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -218,7 +235,7 @@ public class FamilyIntersectingIteratorT
       Key k = iter.getTopKey();
       Value v = iter.getTopValue();
       assertTrue(docs.contains(iter.getDocID(k)));
-      assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k)));
+      assertTrue(new String(v.get()).endsWith(" docID=" + iter.getDocID(k)));
       iter.next();
     }
     assertEquals(hitCount, docs.size());
@@ -247,10 +264,10 @@ public class FamilyIntersectingIteratorT
     sourceIters.add(source);
     sourceIters.add(source2);
     MultiIterator mi = new MultiIterator(sourceIters, false);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(FamilyIntersectingIterator.columnFamiliesOptionName, FamilyIntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, FamilyIntersectingIterator.class);
+    FamilyIntersectingIterator.setColumnFamilies(is, columnFamilies);
     FamilyIntersectingIterator iter = new FamilyIntersectingIterator();
-    iter.init(mi, options, env);
+    iter.init(mi, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -258,10 +275,49 @@ public class FamilyIntersectingIteratorT
       Key k = iter.getTopKey();
       Value v = iter.getTopValue();
       assertTrue(docs.contains(iter.getDocID(k)));
-      assertTrue(new String(v.get()).endsWith(" docID="+iter.getDocID(k)));
+      assertTrue(new String(v.get()).endsWith(" docID=" + iter.getDocID(k)));
       iter.next();
     }
     assertEquals(hitCount, docs.size());
     cleanup();
   }
+  
+  public void test4() throws IOException {
+    columnFamilies = new Text[3];
+    boolean[] notFlags = new boolean[3];
+    columnFamilies[0] = new Text("A");
+    notFlags[0] = true;
+    columnFamilies[1] = new Text("E");
+    notFlags[1] = false;
+    columnFamilies[2] = new Text("G");
+    notFlags[2] = true;
+    Text[] negatedColumns = new Text[2];
+    negatedColumns[0] = new Text("A");
+    negatedColumns[1] = new Text("G");
+    otherColumnFamilies = new Text[4];
+    otherColumnFamilies[0] = new Text("B");
+    otherColumnFamilies[1] = new Text("C");
+    otherColumnFamilies[2] = new Text("D");
+    otherColumnFamilies[3] = new Text("F");
+    
+    hitRatio = 0.5f;
+    HashSet<Text> docs = new HashSet<Text>();
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
+    IteratorSetting is = new IteratorSetting(1, FamilyIntersectingIterator.class);
+    FamilyIntersectingIterator.setColumnFamilies(is, columnFamilies, notFlags);
+    FamilyIntersectingIterator iter = new FamilyIntersectingIterator();
+    iter.init(source, is.getProperties(), env);
+    iter.seek(new Range(), EMPTY_COL_FAMS, false);
+    int hitCount = 0;
+    while (iter.hasTop()) {
+      hitCount++;
+      Key k = iter.getTopKey();
+      Value v = iter.getTopValue();
+      assertTrue(docs.contains(iter.getDocID(k)));
+      assertTrue(new String(v.get()).endsWith(" docID=" + iter.getDocID(k)));
+      iter.next();
+    }
+    assertTrue(hitCount == docs.size());
+    cleanup();
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilteringIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilteringIteratorTest.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilteringIteratorTest.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilteringIteratorTest.java
Tue Nov 29 16:58:41 2011
@@ -31,8 +31,6 @@ import org.apache.accumulo.core.data.Col
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.FilteringIterator;
-import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.filter.AgeOffFilter;
 import org.apache.accumulo.core.iterators.filter.ColumnAgeOffFilter;
 import org.apache.accumulo.core.iterators.filter.ColumnQualifierFilter;
@@ -42,7 +40,9 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.hadoop.io.Text;
 
-@SuppressWarnings("deprecation")
+/**
+ * @deprecated since 1.4
+ */
 public class FilteringIteratorTest extends TestCase {
   
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/IntersectingIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/IntersectingIteratorTest.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/IntersectingIteratorTest.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/IntersectingIteratorTest.java
Tue Nov 29 16:58:41 2011
@@ -19,21 +19,17 @@ package org.apache.accumulo.core.iterato
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Random;
 import java.util.TreeMap;
 
 import junit.framework.TestCase;
 
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.IteratorEnvironment;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.accumulo.core.iterators.user.IntersectingIterator;
 import org.apache.hadoop.io.Text;
@@ -144,10 +140,10 @@ public class IntersectingIteratorTest ex
     
     hitRatio = 0.5f;
     SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(IntersectingIterator.columnFamiliesOptionName, IntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
+    IntersectingIterator.setColumnFamilies(is, columnFamilies);
     IntersectingIterator iter = new IntersectingIterator();
-    iter.init(source, options, env);
+    iter.init(source, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -173,10 +169,10 @@ public class IntersectingIteratorTest ex
     
     hitRatio = 0.5f;
     SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(IntersectingIterator.columnFamiliesOptionName, IntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
+    IntersectingIterator.setColumnFamilies(is, columnFamilies);
     IntersectingIterator iter = new IntersectingIterator();
-    iter.init(source, options, env);
+    iter.init(source, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -210,10 +206,10 @@ public class IntersectingIteratorTest ex
     sourceIters.add(source);
     sourceIters.add(source2);
     MultiIterator mi = new MultiIterator(sourceIters, false);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(IntersectingIterator.columnFamiliesOptionName, IntersectingIterator.encodeColumns(columnFamilies));
+    IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
+    IntersectingIterator.setColumnFamilies(is, columnFamilies);
     IntersectingIterator iter = new IntersectingIterator();
-    iter.init(mi, options, env);
+    iter.init(mi, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {
@@ -246,11 +242,10 @@ public class IntersectingIteratorTest ex
     
     hitRatio = 0.5f;
     SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
-    Map<String,String> options = new HashMap<String,String>();
-    options.put(IntersectingIterator.columnFamiliesOptionName, IntersectingIterator.encodeColumns(columnFamilies));
-    options.put(IntersectingIterator.notFlagOptionName, IntersectingIterator.encodeBooleans(notFlags));
+    IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
+    IntersectingIterator.setColumnFamilies(is, columnFamilies, notFlags);
     IntersectingIterator iter = new IntersectingIterator();
-    iter.init(source, options, env);
+    iter.init(source, is.getProperties(), env);
     iter.seek(new Range(), EMPTY_COL_FAMS, false);
     int hitCount = 0;
     while (iter.hasTop()) {

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExIteratorTest.java?rev=1207970&r1=1207969&r2=1207970&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExIteratorTest.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExIteratorTest.java
Tue Nov 29 16:58:41 2011
@@ -22,19 +22,18 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.TreeMap;
 
+import junit.framework.TestCase;
+
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.FilteringIterator;
-import org.apache.accumulo.core.iterators.RegExIterator;
-import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.filter.RegExFilter;
 import org.apache.hadoop.io.Text;
 
-import junit.framework.TestCase;
-
-@SuppressWarnings("deprecation")
+/**
+ * @deprecated since 1.4
+ */
 public class RegExIteratorTest extends TestCase {
   
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();



Mime
View raw message