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


Java SortedKeyValueIterator.next方法代码示例

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


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

示例1: 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

示例2: TestData

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
TestData(SortedKeyValueIterator<Key, Value> iter, Range range, boolean reseek) {
  try {
    iter.seek(range, new HashSet<ByteSequence>(), false);

    while (iter.hasTop()) {
      data.put(iter.getTopKey(), iter.getTopValue());
      if (reseek) {
        iter.seek(
            new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive()),
            new HashSet<ByteSequence>(), false);
      } else {
        iter.next();
      }
    }
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:19,代码来源:TestData.java

示例3: findTopEnhanced

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
protected static void findTopEnhanced(
		final SortedKeyValueIterator<Key, Value> source,
		final Filter filter ) {
	Key key;
	if (source.hasTop()) {
		key = source.getTopKey();
	}
	else {
		return;
	}
	while (!key.isDeleted() && !filter.accept(
			key,
			source.getTopValue())) {
		try {
			source.next();
			if (source.hasTop()) {
				key = source.getTopKey();
			}
			else {
				return;
			}
		}
		catch (final IOException e) {
			throw new RuntimeException(
					e);
		}
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:29,代码来源:QueryFilterIterator.java

示例4: acceptRow

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
@Override
public boolean acceptRow(
		final SortedKeyValueIterator<Key, Value> rowIterator )
		throws IOException {
	if (filter != null) {
		while (rowIterator.hasTop()) {
			final Key key = rowIterator.getTopKey();
			final Value value = rowIterator.getTopValue();
			final String cq = StringUtils.stringFromBinary(key.getColumnQualifierData().getBackingArray());
			if (!cq.equals(primaryIndexId)) {
				final IndexedPersistenceEncoding<ByteArrayId> persistenceEncoding = new IndexedPersistenceEncoding<ByteArrayId>(
						null, // not needed
						null, // not needed
						null, // not needed
						0, // not needed
						new PersistentDataset<ByteArrayId>(
								new PersistentValue<ByteArrayId>(
										new ByteArrayId(
												key.getColumnQualifierData().getBackingArray()),
										new ByteArrayId(
												value.get()))),
						null);
				if (filter.accept(
						null,
						persistenceEncoding)) return true;
			}
			rowIterator.next();
		}
		return false;
	}
	// should not happen but if the filter is not sent to this iterator, it
	// will accept everything
	return true;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:35,代码来源:SecondaryIndexQueryFilterIterator.java

示例5: next

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
public void next() throws IOException {
  
  // always start fresh
  this.setTopKey(null);
  
  if (log.isDebugEnabled()) {
    TreeNode[] path = this.getPath();
    log.debug("BLTNODE.next() path-> " + this.buildTreePathString(path));
  }
  
  // have I been marked as done?
  if (this.isDone()) {
    if (log.isDebugEnabled()) {
      log.debug("I've been marked as done, returning");
    }
    return;
  }
  
  SortedKeyValueIterator<?,?> iter = (SortedKeyValueIterator<?,?>) this.getUserObject();
  iter.next();
  
  if (iter.hasTop()) {
    Key key = (Key) iter.getTopKey();
    
    // I have a valid topKey, pull out the piece I want
    key = buildKey(key);
    this.setTopKey(key);
    
    if (log.isDebugEnabled()) {
      log.debug("BLTNODE.next() -> found: " + this.getTopKey());
    }
  } else {
    // no top value has been returned, I'm done.
    if (log.isDebugEnabled()) {
      log.debug("BLTNODE.next() -> Nothing found");
    }
    this.setTopKey(null);
    this.setDone(true);
  }
  
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:42,代码来源:BooleanLogicTreeNode.java

示例6: transformRange

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
@Override
protected void transformRange(
		final SortedKeyValueIterator<Key, Value> input,
		final KVBuffer output )
		throws IOException {
	Mergeable currentMergeable = null;
	Key outputKey = null;
	while (input.hasTop()) {
		final Value val = input.getTopValue();
		// the SortedKeyValueIterator uses the same instance of topKey to
		// hold keys (a wrapper)
		final Key currentKey = new Key(
				input.getTopKey());
		if (outputKey == null) {
			outputKey = currentKey;
		}
		else if ((currentMergeable != null) && !outputKey.getRowData().equals(
				currentKey.getRowData())) {
			output.append(
					outputKey,
					new Value(
							AccumuloUtils.toBinary(currentMergeable)));
			currentMergeable = null;
			outputKey = currentKey;
			continue;
		}
		else {
			final Text combinedVisibility = new Text(
					combineVisibilities(
							currentKey.getColumnVisibility().getBytes(),
							outputKey.getColumnVisibility().getBytes()));
			outputKey = replaceColumnVisibility(
					outputKey,
					combinedVisibility);
		}
		final Mergeable mergeable = getMergeable(
				currentKey,
				val.get());
		// hopefully its never the case that null mergeables are stored,
		// but just in case, check
		if (mergeable != null) {
			if (currentMergeable == null) {
				currentMergeable = mergeable;
			}
			else {
				currentMergeable.merge(mergeable);
			}
		}
		input.next();
	}
	if (currentMergeable != null) {
		output.append(
				outputKey,
				new Value(
						getBinary(currentMergeable)));
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:58,代码来源:MergingVisibilityCombiner.java

示例7: transformRange

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
@Override
protected void transformRange(
		final SortedKeyValueIterator<Key, Value> input,
		final KVBuffer output )
		throws IOException {
	while (input.hasTop()) {
		final Key wholeRowKey = input.getTopKey();
		final Value wholeRowVal = input.getTopValue();
		final SortedMap<Key, Value> rowMapping;
		if (wholeRowEncoded) {
			rowMapping = WholeRowIterator.decodeRow(
					wholeRowKey,
					wholeRowVal);
		}
		else {
			rowMapping = new TreeMap<Key, Value>();
			rowMapping.put(
					wholeRowKey,
					wholeRowVal);
		}
		final List<Key> keyList = new ArrayList<>();
		final List<Value> valList = new ArrayList<>();
		Text adapterId = null;

		for (final Entry<Key, Value> row : rowMapping.entrySet()) {
			final Key currKey = row.getKey();
			final Value currVal = row.getValue();
			if (adapterId == null) {
				adapterId = currKey.getColumnFamily();
			}
			final byte[] originalBitmask = currKey.getColumnQualifierData().getBackingArray();
			final byte[] newBitmask = BitmaskUtils.generateANDBitmask(
					originalBitmask,
					fieldSubsetBitmask);
			if (BitmaskUtils.isAnyBitSet(newBitmask)) {
				if (!Arrays.equals(
						newBitmask,
						originalBitmask)) {
					keyList.add(replaceColumnQualifier(
							currKey,
							new Text(
									newBitmask)));
					valList.add(constructNewValue(
							currVal,
							originalBitmask,
							newBitmask));
				}
				else {
					// pass along unmodified
					keyList.add(currKey);
					valList.add(currVal);
				}
			}
		}
		if (!keyList.isEmpty() && !valList.isEmpty()) {
			final Value outputVal;
			final Key outputKey;
			if (wholeRowEncoded) {
				outputKey = new Key(
						wholeRowKey.getRow(),
						adapterId);
				outputVal = WholeRowIterator.encodeRow(
						keyList,
						valList);
			}
			else {
				outputKey = keyList.get(0);
				outputVal = valList.get(0);
			}
			output.append(
					outputKey,
					outputVal);
		}
		input.next();
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:77,代码来源:AttributeSubsettingIterator.java

示例8: next

import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
public void next() throws IOException {

        // always start fresh
        this.setTopKey(null);

        if (log.isDebugEnabled()) {
            TreeNode[] path = this.getPath();
            log.debug("BLTNODE.next() path-> " + this.buildTreePathString(path));
        }

        // have I been marked as done?
        if (this.isDone()) {
            if (log.isDebugEnabled()) {
                log.debug("I've been marked as done, returning");
            }
            return;
        }

        SortedKeyValueIterator<?, ?> iter = (SortedKeyValueIterator<?, ?>) this.getUserObject();
        iter.next();

        if (iter.hasTop()) {
            Key key = (Key) iter.getTopKey();

            // I have a valid topKey, pull out the piece I want
            key = buildKey(key);
            this.setTopKey(key);

            if (log.isDebugEnabled()) {
                log.debug("BLTNODE.next() -> found: " + this.getTopKey());
            }
        } else {
            // no top value has been returned, I'm done.
            if (log.isDebugEnabled()) {
                log.debug("BLTNODE.next() -> Nothing found");
            }
            this.setTopKey(null);
            this.setDone(true);
        }

    }
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:42,代码来源:BooleanLogicTreeNode.java


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