use of datawave.query.iterator.profile.MultiThreadedQuerySpan in project datawave by NationalSecurityAgency.
the class QueryIterator method init.
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
if (log.isTraceEnabled()) {
log.trace("QueryIterator init()");
}
if (!validateOptions(new SourcedOptions<>(source, env, options))) {
throw new IllegalArgumentException("Could not initialize QueryIterator with " + options);
}
// We want to add in spoofed dataTypes for Aggregation/Evaluation to
// ensure proper numeric evaluation.
this.typeMetadata = new TypeMetadata(this.getTypeMetadata());
this.typeMetadataWithNonIndexed = new TypeMetadata(this.typeMetadata);
this.typeMetadataWithNonIndexed.addForAllIngestTypes(this.getNonIndexedDataTypeMap());
this.exceededOrEvaluationCache = new HashMap<>();
// Parse the query
try {
this.script = JexlASTHelper.parseJexlQuery(this.getQuery());
this.myEvaluationFunction = new JexlEvaluation(this.getQuery(), arithmetic);
} catch (Exception e) {
throw new IOException("Could not parse the JEXL query: '" + this.getQuery() + "'", e);
}
this.documentOptions = options;
this.myEnvironment = env;
if (gatherTimingDetails()) {
this.trackingSpan = new MultiThreadedQuerySpan(getStatsdClient());
this.source = new SourceTrackingIterator(trackingSpan, source);
} else {
this.source = source;
}
this.fiAggregator = new IdentityAggregator(getAllIndexOnlyFields(), getEvaluationFilter(), getEvaluationFilter() != null ? getEvaluationFilter().getMaxNextCount() : -1);
if (isDebugMultithreadedSources()) {
this.source = new SourceThreadTrackingIterator(this.source);
}
this.sourceForDeepCopies = this.source.deepCopy(this.myEnvironment);
// update ActiveQueryLog with (potentially) updated config
if (env != null) {
ActiveQueryLog.setConfig(env.getConfig());
}
DatawaveFieldIndexListIteratorJexl.FSTManager.setHdfsFileSystem(this.getFileSystemCache());
DatawaveFieldIndexListIteratorJexl.FSTManager.setHdfsFileCompressionCodec(this.getHdfsFileCompressionCodec());
pruneIvaratorCacheDirs();
}
Aggregations