Search in sources :

Example 1 with TupleToEntry

use of datawave.query.util.TupleToEntry in project datawave by NationalSecurityAgency.

the class QueryIterator method mapDocument.

protected Iterator<Entry<Key, Document>> mapDocument(SortedKeyValueIterator<Key, Value> deepSourceCopy, Iterator<Entry<Key, Document>> documents, CompositeMetadata compositeMetadata) {
    // now lets pull the data if we need to
    if (log.isTraceEnabled()) {
        log.trace("mapDocument " + fieldIndexSatisfiesQuery);
    }
    if (fieldIndexSatisfiesQuery) {
        final KeyToDocumentData docMapper = new KeyToDocumentData(deepSourceCopy, this.myEnvironment, this.documentOptions, super.equality, getEvaluationFilter(), this.includeHierarchyFields, this.includeHierarchyFields);
        Iterator<Tuple2<Key, Document>> mappedDocuments = Iterators.transform(documents, new GetDocument(docMapper, new Aggregation(this.getTimeFilter(), typeMetadataWithNonIndexed, compositeMetadata, this.isIncludeGroupingContext(), this.includeRecordId, this.disableIndexOnlyDocuments(), getEvaluationFilter(), isTrackSizes())));
        Iterator<Entry<Key, Document>> retDocuments = Iterators.transform(mappedDocuments, new TupleToEntry<>());
        // Inject the document permutations if required
        if (!this.getDocumentPermutations().isEmpty()) {
            if (gatherTimingDetails()) {
                retDocuments = Iterators.transform(retDocuments, new EvaluationTrackingFunction<>(QuerySpan.Stage.DocumentPermutation, trackingSpan, new DocumentPermutation.DocumentPermutationAggregation(this.getDocumentPermutations())));
            } else {
                retDocuments = Iterators.transform(retDocuments, new DocumentPermutation.DocumentPermutationAggregation(this.getDocumentPermutations()));
            }
        }
        return retDocuments;
    }
    return documents;
}
Also used : Aggregation(datawave.query.function.Aggregation) DocumentPermutation(datawave.query.function.DocumentPermutation) Entry(java.util.Map.Entry) TupleToEntry(datawave.query.util.TupleToEntry) EvaluationTrackingFunction(datawave.query.iterator.profile.EvaluationTrackingFunction) Tuple2(datawave.query.util.Tuple2) KeyToDocumentData(datawave.query.function.KeyToDocumentData)

Aggregations

Aggregation (datawave.query.function.Aggregation)1 DocumentPermutation (datawave.query.function.DocumentPermutation)1 KeyToDocumentData (datawave.query.function.KeyToDocumentData)1 EvaluationTrackingFunction (datawave.query.iterator.profile.EvaluationTrackingFunction)1 Tuple2 (datawave.query.util.Tuple2)1 TupleToEntry (datawave.query.util.TupleToEntry)1 Entry (java.util.Map.Entry)1