本文整理汇总了Java中org.apache.accumulo.core.iterators.IteratorEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java IteratorEnvironment类的具体用法?Java IteratorEnvironment怎么用?Java IteratorEnvironment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IteratorEnvironment类属于org.apache.accumulo.core.iterators包,在下文中一共展示了IteratorEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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.IteratorEnvironment; //导入依赖的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.IteratorEnvironment; //导入依赖的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: addSource
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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++;
}
示例5: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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);
}
示例6: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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);
}
}
示例7: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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;
}
示例8: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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();
}
示例9: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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;
}
示例10: addSource
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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++;
}
示例11: addSource
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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++;
}
示例12: createIterator
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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);
}
示例13: getAndIterator
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的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;
}
示例14: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的package包/类
@Override
public void init(final SortedKeyValueIterator<Key, Value> source, final Map<String, String> options,
final IteratorEnvironment env) throws IOException {
super.init(source, options, env);
if (options.containsKey(AccumuloStoreConstants.INCOMING_EDGE_ONLY)) {
incomingEdges = true;
} else if (options.containsKey(AccumuloStoreConstants.OUTGOING_EDGE_ONLY)) {
outgoingEdges = true;
}
if (options.containsKey(AccumuloStoreConstants.DIRECTED_EDGE_ONLY)) {
directedEdges = true;
} else if (options.containsKey(AccumuloStoreConstants.UNDIRECTED_EDGE_ONLY)) {
unDirectedEdges = true;
}
if (options.containsKey(AccumuloStoreConstants.INCLUDE_ENTITIES)) {
entities = true;
}
if (options.containsKey(AccumuloStoreConstants.INCLUDE_EDGES)) {
edges = true;
}
if (options.containsKey(AccumuloStoreConstants.DEDUPLICATE_UNDIRECTED_EDGES)) {
deduplicateUndirectedEdges = true;
}
}
示例15: init
import org.apache.accumulo.core.iterators.IteratorEnvironment; //导入依赖的package包/类
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env)
throws IOException {
super.init(source, options, env);
if (options.containsKey(USER_AUTHORIZATION_BASE64)) {
try {
userAuthorization =
ThriftUtils.deserializeFromBase64(Authorizations.class,
options.get(USER_AUTHORIZATION_BASE64));
} catch (final TException e) {
throw new IOException(e);
}
} else {
throw new IllegalArgumentException("Missing required key: " + USER_AUTHORIZATION_BASE64);
}
if (options.containsKey(REQUIRED_PERMISSIONS)) {
for (final String perm : options.get(REQUIRED_PERMISSIONS).split(",")) {
requiredPermissions.add(Permission.valueOf(perm));
}
} else {
throw new IllegalArgumentException("Missing required key: " + REQUIRED_PERMISSIONS);
}
}