Search in sources :

Example 1 with MultiThreadedQuerySpan

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();
}
Also used : TypeMetadata(datawave.query.util.TypeMetadata) SourceTrackingIterator(datawave.query.iterator.profile.SourceTrackingIterator) JexlEvaluation(datawave.query.function.JexlEvaluation) MultiThreadedQuerySpan(datawave.query.iterator.profile.MultiThreadedQuerySpan) IdentityAggregator(datawave.query.jexl.functions.IdentityAggregator) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) ConfigException(org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException) IterationInterruptedException(org.apache.accumulo.core.iterators.IterationInterruptedException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) TabletClosedException(org.apache.accumulo.tserver.tablet.TabletClosedException) MalformedURLException(java.net.MalformedURLException)

Aggregations

JexlEvaluation (datawave.query.function.JexlEvaluation)1 MultiThreadedQuerySpan (datawave.query.iterator.profile.MultiThreadedQuerySpan)1 SourceTrackingIterator (datawave.query.iterator.profile.SourceTrackingIterator)1 IdentityAggregator (datawave.query.jexl.functions.IdentityAggregator)1 TypeMetadata (datawave.query.util.TypeMetadata)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 MalformedURLException (java.net.MalformedURLException)1 IterationInterruptedException (org.apache.accumulo.core.iterators.IterationInterruptedException)1 TabletClosedException (org.apache.accumulo.tserver.tablet.TabletClosedException)1 ConfigException (org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException)1