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


Java SortedKeyValueIterator类代码示例

本文整理汇总了Java中org.apache.accumulo.core.iterators.SortedKeyValueIterator的典型用法代码示例。如果您正苦于以下问题:Java SortedKeyValueIterator类的具体用法?Java SortedKeyValueIterator怎么用?Java SortedKeyValueIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env)
        throws IOException {
    super.init(source, options, env);
    long start = Long.parseLong(options.get(START));
    long end = Long.parseLong(options.get(END));
    long period = Long.parseLong(options.get(PERIOD));
    String aggClassname = options.get(AGGCLASS);
    Class<?> aggClass;
    try {
        aggClass = this.getClass().getClassLoader().loadClass(aggClassname);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
    factory = new DownsampleFactory(start, end, period, (Class<? extends Aggregator>) aggClass);
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:18,代码来源:DownsampleIterator.java

示例2: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env)
        throws IOException {
    super.init(source, options, env);
    validateOptions(options);
    ageoffs = new PatriciaTrie<>();
    options.forEach((k, v) -> {
        if (k.startsWith(AGE_OFF_PREFIX)) {
            String name = k.substring(AGE_OFF_PREFIX.length());
            LOG.trace("Adding {} to Trie with value {}", name, Long.parseLong(v));
            long ageoff = Long.parseLong(v);
            this.minAgeOff = Math.min(this.minAgeOff, ageoff);
            this.maxAgeOff = Math.max(this.maxAgeOff, ageoff);
            ageoffs.put(name, ageoff);
        }
    });
    defaultAgeOff = ageoffs.get(DEFAULT_AGEOFF_KEY);
    currentTime = System.currentTimeMillis();
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:20,代码来源:MetricAgeOffIterator.java

示例3: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env)
        throws IOException {
    super.init(source, options, env);
    validateOptions(options);
    ageoffs = new PatriciaTrie<>();
    options.forEach((k, v) -> {
        if (k.startsWith(AGE_OFF_PREFIX)) {
            String name = k.substring(AGE_OFF_PREFIX.length());
            LOG.trace("Adding {} to Trie with value", name, Long.parseLong(v));
            long ageoff = Long.parseLong(v);
            this.minAgeOff = Math.min(this.minAgeOff, ageoff);
            this.maxAgeOff = Math.max(this.maxAgeOff, ageoff);
            ageoffs.put(name, ageoff);
        }
    });
    defaultAgeOff = ageoffs.get(DEFAULT_AGEOFF_KEY);
    currentTime = System.currentTimeMillis();
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:20,代码来源:MetricAgeOffFilter.java

示例4: runTest

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
private void runTest(boolean reseek, TreeMap<Key,Value> source, TreeMap<Key,Value> result, Collection<ByteSequence> cols) throws IOException {
  MapIterator src = new MapIterator(source);
  SortedKeyValueIterator<Key,Value> iter = new ChunkCombiner();
  iter.init(src, null, null);
  iter = iter.deepCopy(null);
  iter.seek(new Range(), cols, true);

  TreeMap<Key,Value> seen = new TreeMap<>();

  while (iter.hasTop()) {
    assertFalse("already contains " + iter.getTopKey(), seen.containsKey(iter.getTopKey()));
    seen.put(new Key(iter.getTopKey()), new Value(iter.getTopValue()));

    if (reseek)
      iter.seek(new Range(iter.getTopKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL), true, null, true), cols, true);
    else
      iter.next();
  }

  assertEquals(result, seen);
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:22,代码来源:ChunkCombinerTest.java

示例5: addSource

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
public void addSource(SortedKeyValueIterator<Key,Value> source, IteratorEnvironment env, Text dataLocation, Text term, boolean notFlag) {
  // Check if we have space for the added Source
  if (sources == null) {
    sources = new TermSource[1];
  } else {
    // allocate space for node, and copy current tree.
    // TODO: Should we change this to an ArrayList so that we can just add() ?
    TermSource[] localSources = new TermSource[sources.length + 1];
    int currSource = 0;
    for (TermSource myTerm : sources) {
      // TODO: Do I need to call new here? or can I just re-use the term?
      localSources[currSource] = new TermSource(myTerm);
      currSource++;
    }
    sources = localSources;
  }
  
  sources[sourcesCount] = new TermSource(source.deepCopy(env), dataLocation, term, notFlag);
  sourcesCount++;
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:21,代码来源:AndIterator.java

示例6: createOrIterator

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
private OrIterator createOrIterator(BooleanLogicTreeNode node) throws IOException {
  if (log.isDebugEnabled()) {
    log.debug("createOrIterator(node)");
    log.debug("fName: " + node.getFieldName() + " , fValue: " + node.getFieldValue() + " , operator: " + node.getFieldOperator());
  }
  
  Enumeration<?> children = node.children();
  ArrayList<Text> fams = new ArrayList<Text>();
  ArrayList<Text> quals = new ArrayList<Text>();
  while (children.hasMoreElements()) {
    BooleanLogicTreeNode child = (BooleanLogicTreeNode) children.nextElement();
    fams.add(child.getFieldName());
    quals.add(child.getFieldValue());
  }
  
  OrIterator iter = new OrIterator();
  SortedKeyValueIterator<Key,Value> source = sourceIterator.deepCopy(env);
  for (int i = 0; i < fams.size(); i++) {
    iter.addTerm(source, fams.get(i), quals.get(i), env);
  }
  
  return iter;
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:24,代码来源:BooleanLogicIterator.java

示例7: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
  validateOptions(options);
  event = new EventFields();
  this.comparator = getKeyComparator();
  this.iterator = source;
  try {
    // Replace any expressions that we should not evaluate.
    if (null != this.skipExpressions && this.skipExpressions.size() != 0) {
      for (String skip : this.skipExpressions) {
        // Expression should have form: field<sp>operator<sp>literal.
        // We are going to replace the expression with field == null.
        String field = skip.substring(0, skip.indexOf(" ") - 1);
        this.expression = this.expression.replaceAll(skip, field + " == null");
      }
    }
    this.evaluator = new QueryEvaluator(this.expression);
  } catch (ParseException e) {
    throw new IllegalArgumentException("Failed to parse query", e);
  }
  EventFields.initializeKryo(kryo);
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:22,代码来源:AbstractEvaluatingIterator.java

示例8: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
  if (!validateOptions(options)) {
    throw new IllegalArgumentException("Invalid options");
  }
  
  // Setup the EvaluatingIterator
  event = new EvaluatingIterator();
  event.init(source.deepCopy(env), options, env);
  
  // if queue size and timeout are set, then use the read ahead iterator
  if (options.containsKey(ReadAheadIterator.QUEUE_SIZE) && options.containsKey(ReadAheadIterator.TIMEOUT)) {
    BooleanLogicIterator bli = new BooleanLogicIterator();
    bli.init(source, options, env);
    index = new ReadAheadIterator();
    index.init(bli, options, env);
  } else {
    index = new BooleanLogicIterator();
    // index.setDebug(Level.DEBUG);
    index.init(source, options, env);
  }
  
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:23,代码来源:OptimizedQueryIterator.java

示例9: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);

    Set<String> labels = new HashSet<>();
    Set<String> excludedLabels = new HashSet<>();
    for (Map.Entry<String, String> option : options.entrySet()) {
        if (option.getKey().startsWith(SETTING_LABEL_PREFIX)) {
            labels.add(option.getValue());
        } else if (option.getKey().startsWith(SETTING_EXCLUDED_LABEL_PREFIX)) {
            excludedLabels.add(option.getValue());
        }
    }
    this.labels = labels.size() == 0 ? null : labels;
    this.excludedLabels = excludedLabels.size() == 0 ? null : excludedLabels;
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:17,代码来源:ConnectedVertexIdsIterator.java

示例10: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    if (options == null) {
        throw new IllegalArgumentException("options must be set for TimeRangeFilter");
    }

    timeRange = -1;
    String timeRange_s = options.get(TIME_RANGE_PROP);
    if (timeRange_s == null)
        throw new IllegalArgumentException("timeRange must be set for TimeRangeFilter");

    timeRange = Long.parseLong(timeRange_s);

    String time = options.get(START_TIME_PROP);
    if (time != null)
        startTime = Long.parseLong(time);
    else
        startTime = System.currentTimeMillis();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:21,代码来源:TimeRangeFilter.java

示例11: init

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
  TextColumn[] terms = decodeColumns(options.get(columnOptionName));
  boolean[] prefixes = decodeBooleans(options.get(columnPrefix));
  ctxt = decodeContext(options.get(context));
  
  if(ctxt != null) {
      hasContext = true;
  }

 
  
  if (terms.length < 2) {
    throw new IllegalArgumentException("IntersectionIterator requires two or more columns families");
  }
  
  sources = new TermSource[terms.length];
  sources[0] = new TermSource(source, terms[0]);
  for (int i = 1; i < terms.length; i++) {
      //log.info("For decoded column " + i + " column family is " + terms[i].getColumnFamily() + " and qualifier is " + terms[i].getColumnQualifier());
    sources[i] = new TermSource(source.deepCopy(env), terms[i]);
    sources[i].isPrefix = prefixes[i];
  }
  sourcesCount = terms.length;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:DocumentIndexIntersectingIterator.java

示例12: addSource

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
public void addSource(SortedKeyValueIterator<Key,Value> source, IteratorEnvironment env, TextColumn column) {
  // Check if we have space for the added Source
  if (sources == null) {
    sources = new TermSource[1];
  } else {
    // allocate space for node, and copy current tree.
    // TODO: Should we change this to an ArrayList so that we can just add() ? - ACCUMULO-1309
    TermSource[] localSources = new TermSource[sources.length + 1];
    int currSource = 0;
    for (TermSource myTerm : sources) {
      // TODO: Do I need to call new here? or can I just re-use the term? - ACCUMULO-1309
      localSources[currSource] = new TermSource(myTerm);
      currSource++;
    }
    sources = localSources;
  }
  sources[sourcesCount] = new TermSource(source.deepCopy(env), column);
  sourcesCount++;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:DocumentIndexIntersectingIterator.java

示例13: addSource

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
public void addSource(final SortedKeyValueIterator<Key, Value> source, final IteratorEnvironment env, final Text term, final boolean notFlag) {
	// Check if we have space for the added Source
	if (sources == null) {
		sources = new TermSource[1];
	} else {
		// allocate space for node, and copy current tree.
		// TODO: Should we change this to an ArrayList so that we can just add() ?
		final TermSource[] localSources = new TermSource[sources.length + 1];
		int currSource = 0;
		for (final TermSource myTerm : sources) {
			// TODO: Do I need to call new here? or can I just re-use the term?
			localSources[currSource] = new TermSource(myTerm);
			currSource++;
		}
		sources = localSources;
	}
	sources[sourcesCount] = new TermSource(source.deepCopy(env), term, notFlag);
	sourcesCount++;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:AndingIterator.java

示例14: createIterator

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
private SortedKeyValueIterator<Key, Value> createIterator(SimpleNode root, SortedKeyValueIterator<Key, Value> source,
        IteratorEnvironment env) {
    // if the root is only a single term, wrap it in an expression node
    if (root instanceof ASTTerm) {
        ASTExpression expression = new ASTExpression(QueryParserTreeConstants.JJTEXPRESSION);
        expression.setNotFlag(false);
        expression.setType(ASTExpression.AND);

        pushChild(expression, root);
        root.jjtSetParent(expression);

        root = expression;
    }

    // Pre-process the tree to compensate for iterator specific issues with certain topologies
    preProcessTree(root);

    // Build an iterator tree
    return createIteratorRecursive(root, source, env);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:21,代码来源:BooleanTreeIterator.java

示例15: getAndIterator

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入依赖的package包/类
private AndingIterator getAndIterator(SimpleNode node, SortedKeyValueIterator<Key, Value> source, IteratorEnvironment env) {

        AndingIterator anding = new AndingIterator();

        for (SimpleNode n : getNodeIterator(node)) {
            boolean isNotFlag = isNotFlag(n);
            if (n instanceof ASTExpression) {
                anding.addSource(createIteratorRecursive(n, source, env), env, null, isNotFlag);
            } else if (n instanceof ASTTerm) {
                ASTTerm term = ((ASTTerm) n);
                anding.addSource(source, env, getTermColFam(term), isNotFlag);
            } else {
                throw new IllegalArgumentException("Node is of unknown type: " + n.getClass().getName());
            }
        }

        return anding;
    }
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:BooleanTreeIterator.java


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