当前位置: 首页>>代码示例>>Java>>正文


Java Scanner.addScanIterator方法代码示例

本文整理汇总了Java中org.apache.accumulo.core.client.Scanner.addScanIterator方法的典型用法代码示例。如果您正苦于以下问题:Java Scanner.addScanIterator方法的具体用法?Java Scanner.addScanIterator怎么用?Java Scanner.addScanIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.accumulo.core.client.Scanner的用法示例。


在下文中一共展示了Scanner.addScanIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createScanner

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
private Scanner createScanner(Query<K,T> query) throws TableNotFoundException {
  // TODO make isolated scanner optional?
  Scanner scanner = new IsolatedScanner(conn.createScanner(mapping.tableName, Constants.NO_AUTHS));
  setFetchColumns(scanner, query.getFields());

  scanner.setRange(createRange(query));

  if (query.getStartTime() != -1 || query.getEndTime() != -1) {
    IteratorSetting is = new IteratorSetting(30, TimestampFilter.class);
    if (query.getStartTime() != -1)
      TimestampFilter.setStart(is, query.getStartTime(), true);
    if (query.getEndTime() != -1)
      TimestampFilter.setEnd(is, query.getEndTime(), true);

    scanner.addScanIterator(is);
  }

  return scanner;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:20,代码来源:AccumuloStore.java

示例2: setupIterators

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Override
protected void setupIterators(final TaskAttemptContext context,
		final Scanner scanner, final String tableName,
		final org.apache.accumulo.core.client.mapreduce.RangeInputSplit split) {
	List<IteratorSetting> iterators = null;

	if (null == split) {
		iterators = contextIterators(context, tableName);
	} else {
		iterators = split.getIterators();
		if (null == iterators) {
			iterators = contextIterators(context, tableName);
		}
	}

	for (final IteratorSetting iterator : iterators) {
              scanner.addScanIterator(iterator);
          }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:GraphXEdgeInputFormat.java

示例3: setupIterators

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Override
protected void setupIterators(TaskAttemptContext context,
		Scanner scanner, String tableName,
		org.apache.accumulo.core.client.mapreduce.RangeInputSplit split) {

	List<IteratorSetting> iterators = null;

	if (null == split) {
		iterators = contextIterators(context, tableName);
	} else {
		iterators = split.getIterators();
		if (null == iterators) {
			iterators = contextIterators(context, tableName);
		}
	}

	for (IteratorSetting iterator : iterators)
		scanner.addScanIterator(iterator);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:GraphXInputFormat.java

示例4: printTablePretty

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
/**
 * Prints the table with pretty formatting using the specified config and additional settings.
 * @param tableName the name of the table to print.
 * @param config the {@link AccumuloRdfConfiguration}.
 * @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner.
 * {@code false} otherwise.
 * @param settings the additional {@link IteratorSetting}s to add besides the common ones.
 * @throws IOException
 */
public static void printTablePretty(final String tableName, final Configuration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException {
    final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators);
    for (final IteratorSetting setting : settings) {
        scanner.addScanIterator(setting);
    }

    final String format = "| %-64s | %-24s | %-28s | %-20s | %-20s | %-10s |";
    final int totalFormatLength = String.format(format, 1, 2, 3, 4, 5, 6).length();
    final String instance = config.get(MRUtils.AC_INSTANCE_PROP);
    log.info(StringUtils.rightPad("==================", totalFormatLength, "="));
    log.info(StringUtils.rightPad("| TABLE: " + tableName + " INSTANCE: " + instance, totalFormatLength - 1) + "|");
    log.info(StringUtils.rightPad("------------------", totalFormatLength, "-"));
    log.info(String.format(format, "--Row--", "--ColumnVisibility--", "--Timestamp--", "--ColumnFamily--", "--ColumnQualifier--", "--Value--"));
    log.info(StringUtils.rightPad("|-----------------", totalFormatLength - 1, "-") + "|");
    for (final Entry<Key, Value> entry : scanner) {
        final Key k = entry.getKey();
        final String rowString = Key.appendPrintableString(k.getRow().getBytes(), 0, k.getRow().getLength(), Constants.MAX_DATA_TO_PRINT, new StringBuilder()).toString();
        log.info(String.format(format, rowString, k.getColumnVisibility(), new Date(k.getTimestamp()), k.getColumnFamily(), k.getColumnQualifier(), entry.getValue()));
    }
    log.info(StringUtils.rightPad("==================", totalFormatLength, "="));
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:31,代码来源:AccumuloRyaUtils.java

示例5: printTable

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
/**
 * Prints the table with the specified config and additional settings.
 * @param tableName the name of the table to print.
 * @param config the {@link AccumuloRdfConfiguration}.
 * @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner.
 * {@code false} otherwise.
 * @param settings the additional {@link IteratorSetting}s to add besides the common ones.
 * @throws IOException
 */
public static void printTable(final String tableName, final AccumuloRdfConfiguration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws IOException {
    final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators);
    for (final IteratorSetting setting : settings) {
        scanner.addScanIterator(setting);
    }

    final Iterator<Entry<Key, Value>> iterator = scanner.iterator();

    final String instance = config.get(MRUtils.AC_INSTANCE_PROP);
    log.info("==================");
    log.info("TABLE: " + tableName + " INSTANCE: " + instance);
    log.info("------------------");
    while (iterator.hasNext()) {
        final Entry<Key, Value> entry = iterator.next();
        final Key key = entry.getKey();
        final Value value = entry.getValue();
        final String keyString = getFormattedKeyString(key);
        log.info(keyString + " - " + value);
    }
    log.info("==================");
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:31,代码来源:AccumuloRyaUtils.java

示例6: singleWildCardSearch

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
/**
 * Scans over the index table for files or directories with a given name that can contain a single wildcard '*' anywhere in the term.
 *
 * @param exp
 *          the name a file or directory to search for with one optional wildcard '*'
 */
public Iterable<Entry<Key,Value>> singleWildCardSearch(String exp) throws Exception {
  int starIndex = exp.indexOf("*");
  if (exp.indexOf("*", starIndex + 1) >= 0)
    throw new Exception("only one wild card for search");

  if (starIndex < 0) {
    return exactTermSearch(exp);
  } else if (starIndex == 0 || starIndex == exp.length() - 1) {
    return singleRestrictedWildCardSearch(exp);
  }

  String firstPart = exp.substring(0, starIndex);
  String lastPart = exp.substring(starIndex + 1);
  String regexString = ".*/" + exp.replace("*", "[^/]*");

  Scanner scanner = conn.createScanner(tableName, auths);
  if (firstPart.length() >= lastPart.length()) {
    System.out.println("executing middle wildcard search for " + regexString + " from entries starting with " + firstPart);
    scanner.setRange(Range.prefix(getForwardIndex(firstPart)));
  } else {
    System.out.println("executing middle wildcard search for " + regexString + " from entries ending with " + lastPart);
    scanner.setRange(Range.prefix(getReverseIndex(lastPart)));
  }
  IteratorSetting regex = new IteratorSetting(50, "regex", RegExFilter.class);
  RegExFilter.setRegexs(regex, null, null, regexString, null, false);
  scanner.addScanIterator(regex);
  return scanner;
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:35,代码来源:QueryUtil.java

示例7: getRowCountFromTable

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
private long getRowCountFromTable(String tableName, Text signalColumn, Authorizations authorizations) {
    try {
        LOGGER.debug("BEGIN getRowCountFromTable(%s)", tableName);
        Scanner scanner = createScanner(tableName, null, authorizations);
        try {
            scanner.fetchColumnFamily(signalColumn);

            IteratorSetting countingIterator = new IteratorSetting(
                    100,
                    CountingIterator.class.getSimpleName(),
                    CountingIterator.class
            );
            scanner.addScanIterator(countingIterator);

            GRAPH_LOGGER.logStartIterator(scanner);

            long count = 0;
            for (Map.Entry<Key, Value> entry : scanner) {
                Long countForKey = LongCombiner.FIXED_LEN_ENCODER.decode(entry.getValue().get());
                LOGGER.debug("getRowCountFromTable(%s): %s: %d", tableName, entry.getKey().getRow(), countForKey);
                count += countForKey;
            }
            LOGGER.debug("getRowCountFromTable(%s): TOTAL: %d", tableName, count);
            return count;
        } finally {
            scanner.close();
        }
    } catch (TableNotFoundException ex) {
        throw new VertexiumException("Could not get count from table: " + tableName, ex);
    }
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:32,代码来源:AccumuloGraph.java

示例8: addCommonScannerIteratorsTo

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
/**
 * Adds all the common regex filter {@link IteratorSetting}s to the provided {@link Scanner} so
 * certain metadata keys in a table are ignored.
 * @param scanner the {@link Scanner} to add the regex filter {@link IteratorSetting}s to.
 */
public static void addCommonScannerIteratorsTo(final Scanner scanner) {
    for (final IteratorSetting iteratorSetting : COMMON_REG_EX_FILTER_SETTINGS) {
        scanner.addScanIterator(iteratorSetting);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloRyaUtils.java

示例9: testContext2

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testContext2() throws Exception {

  BatchWriter bw = null;

      bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

     
      
      for (int i = 0; i < 100; i++) {

                Mutation m = new Mutation(new Text("" + i));
    
                m.put(new Text("cf" + 1), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 1 ), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 2 ), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context2" + "\u0000" +"obj" + "\u0000" + "cq" + 2 ), new Value(new byte[0]));
                

                if(i == 30 || i == 60 || i == 90 || i == 99) {
                    m.put(new Text("cf" + 3), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 3), new Value(new byte[0]));
                    m.put(new Text("cf" + 3), new Text("context2" + "\u0000" +"obj" + "\u0000" + "cq" + 4 ), new Value(new byte[0]));
                    m.put(new Text("cf" + 3), new Text("context3" + "\u0000" +"obj" + "\u0000" + "cq" + 5 ), new Value(new byte[0]));
                 
                }
                
                bw.addMutation(m);

      }
     
      
     
      TextColumn tc1 = new TextColumn(new Text("cf" + 1 ), new Text("obj" + "\u0000" + "cq" + 1));
      TextColumn tc2 = new TextColumn(new Text("cf" + 2), new Text("obj" + "\u0000" + "cq" + 2));
      TextColumn tc3 = new TextColumn(new Text("cf" + 3), new Text("obj"));

      tc3.setIsPrefix(true);
      
      TextColumn[] tc = new TextColumn[3];
      tc[0] = tc1;
      tc[1] = tc2;
      tc[2] = tc3;
    

      IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

      DocumentIndexIntersectingIterator.setColumnFamilies(is, tc);
      DocumentIndexIntersectingIterator.setContext(is, "context2");

      Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
     
      scan.addScanIterator(is);

      int results = 0;
      System.out.println("************************Test 15****************************");
      for (Map.Entry<Key, Value> e : scan) {
          System.out.println(e);
          results++;
      }
      
      
      Assert.assertEquals(0, results);

      
      

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:67,代码来源:DocumentIndexIntersectingIteratorTest.java

示例10: testContext4

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testContext4() throws Exception {

  BatchWriter bw = null;

      bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

     
      
      for (int i = 0; i < 100; i++) {

                Mutation m = new Mutation(new Text("" + i));
    
                m.put(new Text("cf" + 1), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 1), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 2), new Value(new byte[0]));
                m.put(new Text("cf" + 1), new Text("context2" + "\u0000" +"obj" + "\u0000" + "cq" + 1), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context2" + "\u0000" +"obj" + "\u0000" + "cq" + 2), new Value(new byte[0]));
                

                if(i == 30 || i == 60 || i == 90 || i == 99) {
                    m.put(new Text("cf" + 3), new Text("context1" + "\u0000" +"obj" + "\u0000" + "cq" + 3), new Value(new byte[0]));
                    m.put(new Text("cf" + 3), new Text("context2" + "\u0000" +"obj" + "\u0000" + "cq" + 3), new Value(new byte[0]));
                    
                 
                }
                
                bw.addMutation(m);

      }
     
      
     
      TextColumn tc1 = new TextColumn(new Text("cf" + 1 ), new Text("obj" + "\u0000" + "cq" + 1));
      TextColumn tc2 = new TextColumn(new Text("cf" + 2), new Text("obj" + "\u0000" + "cq" + 2));
      TextColumn tc3 = new TextColumn(new Text("cf" + 3), new Text("obj"));

      tc3.setIsPrefix(true);
      
      TextColumn[] tc = new TextColumn[3];
      tc[0] = tc1;
      tc[1] = tc2;
      tc[2] = tc3;
    

      IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

      DocumentIndexIntersectingIterator.setColumnFamilies(is, tc);
     

      Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
     
      scan.addScanIterator(is);

      int results = 0;
      System.out.println("************************Test 17****************************");
      for (Map.Entry<Key, Value> e : scan) {
          System.out.println(e);
          results++;
      }
      
      
      Assert.assertEquals(8, results);

      
      


}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:69,代码来源:DocumentIndexIntersectingIteratorTest.java

示例11: testContext5

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testContext5() throws Exception {

  BatchWriter bw = null;

      bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

     
      
      for (int i = 0; i < 100; i++) {

                Mutation m = new Mutation(new Text("" + i));
    
                m.put(new Text("cf" + 1), new Text("context1" + "\u0000"  + "obj" + "\u0000" + "cq" + 1), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context1" + "\u0000"  + "obj" + "\u0000" + "cq" + 2), new Value(new byte[0]));
                m.put(new Text("cf" + 1), new Text("context2" + "\u0000"  + "obj" + "\u0000" + "cq" + 1), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text("context2" + "\u0000"  + "obj" + "\u0000" + "cq" + 2), new Value(new byte[0]));
                m.put(new Text("cf" + 1), new Text(null + "\u0000" + "obj" + "\u0000" + "cq" + 1 ), new Value(new byte[0]));
                m.put(new Text("cf" + 2), new Text(null + "\u0000" + "obj" + "\u0000" + "cq" + 2 ), new Value(new byte[0]));
                

                if(i == 30 || i == 60 || i == 90 || i == 99) {
                    m.put(new Text("cf" + 3), new Text("context1" + "\u0000"  + "obj" + "\u0000" + "cq" + 3), new Value(new byte[0]));
                    m.put(new Text("cf" + 3), new Text("context2" + "\u0000"  + "obj" + "\u0000" + "cq" + 3 ), new Value(new byte[0]));
                    m.put(new Text("cf" + 3), new Text(null + "\u0000"  + "obj" + "\u0000" + "cq" + 3 ), new Value(new byte[0]));
                    
                 
                }
                
                bw.addMutation(m);

      }
     
      
     
      TextColumn tc1 = new TextColumn(new Text("cf" + 1 ), new Text("obj" + "\u0000" + "cq" + 1));
      TextColumn tc2 = new TextColumn(new Text("cf" + 2), new Text("obj" + "\u0000" + "cq" + 2));
      TextColumn tc3 = new TextColumn(new Text("cf" + 3), new Text("obj"));

      tc3.setIsPrefix(true);
      
      TextColumn[] tc = new TextColumn[3];
      tc[0] = tc1;
      tc[1] = tc2;
      tc[2] = tc3;
    

      IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

      DocumentIndexIntersectingIterator.setColumnFamilies(is, tc);
     

      Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
     
      scan.addScanIterator(is);

      int results = 0;
      System.out.println("************************Test 18****************************");
      for (Map.Entry<Key, Value> e : scan) {
          System.out.println(e);
          results++;
      }
      
      
      Assert.assertEquals(12, results);

      
      

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:71,代码来源:DocumentIndexIntersectingIteratorTest.java

示例12: testBasicColumnObj

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testBasicColumnObj() throws Exception {

    BatchWriter bw = null;

        bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

        for (int i = 0; i < 100; i++) {

            Mutation m = new Mutation(new Text("" + i));
            m.put(new Text("cf"), new Text(null + "\u0000" + "obj" + "\u0000" + "cq"), new Value(new byte[0]));
            m.put(new Text("cF"), new Text(null + "\u0000" +"obj" + "\u0000" + "cQ"), new Value(new byte[0]));

            if (i == 30 || i == 60) {
                m.put(new Text("CF"), new Text(null + "\u0000" +"obj" + "\u0000" + "CQ"), new Value(new byte[0]));
            }

            bw.addMutation(m);

        }
        
        DocumentIndexIntersectingIterator dii = new DocumentIndexIntersectingIterator();
        TextColumn tc1 = new TextColumn(new Text("cf"), new Text("obj" + "\u0000" + "cq" ));
        TextColumn tc2 = new TextColumn(new Text("cF"), new Text("obj" + "\u0000" + "cQ" ));
        TextColumn tc3 = new TextColumn(new Text("CF"), new Text("obj" + "\u0000" + "CQ" ));

        TextColumn[] tc = new TextColumn[3];
        tc[0] = tc1;
        tc[1] = tc2;
        tc[2] = tc3;

        IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

        dii.setColumnFamilies(is, tc);

        Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
        scan.addScanIterator(is);

        int results = 0;
        System.out.println("************************Test 1****************************");
        for (Map.Entry<Key, Value> e : scan) {
            System.out.println(e);
            results++;
        }
        
        
        Assert.assertEquals(2, results);

        
        

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:53,代码来源:DocumentIndexIntersectingIteratorTest.java

示例13: testBasicColumnObjPrefix

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testBasicColumnObjPrefix()  throws Exception {

    BatchWriter bw = null;

        bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

        for (int i = 0; i < 100; i++) {

            Mutation m = new Mutation(new Text("" + i));
            m.put(new Text("cf"), new Text(null + "\u0000" +"obj" + "\u0000" + "cq" ), new Value(new byte[0]));
            m.put(new Text("cF"), new Text(null + "\u0000" +"obj" + "\u0000" + "cQ"), new Value(new byte[0]));

            if (i == 30 || i == 60) {
                m.put(new Text("CF"), new Text(null + "\u0000" +"obj" + "\u0000" + "CQ" ), new Value(new byte[0]));
            }
            
            

            bw.addMutation(m);

        }
        
        DocumentIndexIntersectingIterator dii = new DocumentIndexIntersectingIterator();
        TextColumn tc1 = new TextColumn(new Text("cf"), new Text("obj" + "\u0000" + "cq"));
        TextColumn tc2 = new TextColumn(new Text("cF"), new Text("obj" + "\u0000" + "cQ"));
        TextColumn tc3 = new TextColumn(new Text("CF"), new Text("obj"));

        TextColumn[] tc = new TextColumn[3];
        tc[0] = tc1;
        tc[1] = tc2;
        tc[2] = tc3;
        
        tc3.setIsPrefix(true);

        IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

        dii.setColumnFamilies(is, tc);

        Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
        scan.addScanIterator(is);

        int results = 0;
        System.out.println("************************Test 2****************************");
        for (Map.Entry<Key, Value> e : scan) {
            System.out.println(e);
            results++;
        }
        
        
        Assert.assertEquals(2, results);

        
        

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:57,代码来源:DocumentIndexIntersectingIteratorTest.java

示例14: testLubmLikeTest

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testLubmLikeTest() throws Exception {

  BatchWriter bw = null;

      bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

     
      
      for (int i = 0; i < 100; i++) {

                Mutation m1 = new Mutation(new Text("ProfessorA" + i));
                Mutation m2= new Mutation(new Text("ProfessorB" + i));
    
                m1.put(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom"), 
                        new Text(null + "\u0000" +"object" + "\u0000" + "http://www.University" + i + ".edu"), new Value(new byte[0]));
                m2.put(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom"), 
                        new Text(null + "\u0000" +"object" + "\u0000" + "http://www.University" + i + ".edu"), new Value(new byte[0]));
                m1.put(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf"), 
                        new Text(null + "\u0000" +"object" + "\u0000" + "http://Course" + i), new Value(new byte[0]));
                m2.put(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf"), 
                        new Text(null + "\u0000" +"object" + "\u0000" + "http://Course" + i), new Value(new byte[0]));
            
                
                bw.addMutation(m1);
                bw.addMutation(m2);

      }
     
      
     
      TextColumn tc1 = new TextColumn(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#doctoralDegreeFrom" ), 
              new Text("object" + "\u0000" + "http://www.University" + 30 + ".edu"));
      TextColumn tc2 = new TextColumn(new Text("http://swat.cse.lehigh.edu/onto/univ-bench.owl#teacherOf"), 
              new Text("object" + "\u0000" + "http://Course" + 30));
      


      
      TextColumn[] tc = new TextColumn[2];
      tc[0] = tc1;
      tc[1] = tc2;
     

      IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

      DocumentIndexIntersectingIterator.setColumnFamilies(is, tc);

      Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
      scan.addScanIterator(is);

      int results = 0;
      System.out.println("************************Test 15****************************");
      for (Map.Entry<Key, Value> e : scan) {
          System.out.println(e);
          results++;
      }
      
      
      Assert.assertEquals(2, results);

      
      

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:66,代码来源:DocumentIndexIntersectingIteratorTest.java

示例15: testOneHundredColumnSubjObj

import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
@Test
public void testOneHundredColumnSubjObj() throws Exception {

    BatchWriter bw = null;

        bw = accCon.createBatchWriter(tablename, 500L * 1024L * 1024L, Long.MAX_VALUE, 30);

        for (int i = 0; i < 100; i++) {

            Mutation m = new Mutation(new Text("" + i));
            
            for(int j= 0; j < 100; j++) {
                m.put(new Text("cf" + j), new Text(null + "\u0000" +"obj" + "\u0000" + "cq" + j), new Value(new byte[0]));
            }
            
            if (i == 30 ) {
                m.put(new Text("cf" + 100), new Text(null + "\u0000" +"obj" + "\u0000" + "cq" + 100), new Value(new byte[0]));
            }
            
            if  (i == 60) {
                m.put(new Text("cf" + 100), new Text(null + "\u0000" +"subj" + "\u0000" + "cq" + 100), new Value(new byte[0]));
            }
            
            
            

            bw.addMutation(m);

        }
        
        DocumentIndexIntersectingIterator dii = new DocumentIndexIntersectingIterator();
        TextColumn tc1 = new TextColumn(new Text("cf" + 20), new Text("obj" + "\u0000" + "cq" + 20));
        TextColumn tc2 = new TextColumn(new Text("cf" + 50), new Text("obj" + "\u0000" + "cq" + 50));
        TextColumn tc3 = new TextColumn(new Text("cf" + 100), new Text("obj" + "\u0000" + "cq" + 100));

        TextColumn[] tc = new TextColumn[3];
        tc[0] = tc1;
        tc[1] = tc2;
        tc[2] = tc3;

        IteratorSetting is = new IteratorSetting(30, "fii", DocumentIndexIntersectingIterator.class);

        dii.setColumnFamilies(is, tc);

        Scanner scan = accCon.createScanner(tablename, new Authorizations("auths"));
        scan.addScanIterator(is);

        int results = 0;
        System.out.println("************************Test 4****************************");
        for (Map.Entry<Key, Value> e : scan) {
            System.out.println(e);
            results++;
        }
        
        
        Assert.assertEquals(1, results);

        
        

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:62,代码来源:DocumentIndexIntersectingIteratorTest.java


注:本文中的org.apache.accumulo.core.client.Scanner.addScanIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。