本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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);
}
示例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++;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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();
}
示例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;
}
示例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++;
}
示例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++;
}
示例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);
}
示例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;
}