Search in sources :

Example 1 with EntryArrayList

use of com.thinkaurelius.titan.diskstorage.util.EntryArrayList in project titan by thinkaurelius.

the class HadoopScanMapper method map.

@Override
protected void map(StaticBuffer key, Iterable<Entry> values, Context context) throws IOException, InterruptedException {
    EntryArrayList al = EntryArrayList.of(values);
    // KeyFilter check
    if (!keyFilter.test(key)) {
        log.debug("Skipping key {} based on KeyFilter", key);
        return;
    }
    // InitialQuery check (at least one match is required or else the key is ignored)
    EntryList initialQueryMatches = findEntriesMatchingQuery(initialQuery, al);
    if (0 == initialQueryMatches.size()) {
        log.debug("Skipping key {} based on InitialQuery ({}) match failure", key, initialQuery);
        return;
    }
    // Both conditions (KeyFilter && InitialQuery) for invoking process are satisfied
    // Create an entries parameter to be passed into the process method
    Map<SliceQuery, EntryList> matches = new HashMap<>();
    matches.put(initialQuery, initialQueryMatches);
    // Find matches (if any are present) for noninitial queries
    for (SliceQuery sq : subsequentQueries) {
        matches.put(sq, findEntriesMatchingQuery(sq, al));
    }
    // Process
    job.process(key, matches, metrics);
}
Also used : EntryArrayList(com.thinkaurelius.titan.diskstorage.util.EntryArrayList) EntryList(com.thinkaurelius.titan.diskstorage.EntryList) SliceQuery(com.thinkaurelius.titan.diskstorage.keycolumnvalue.SliceQuery)

Aggregations

EntryList (com.thinkaurelius.titan.diskstorage.EntryList)1 SliceQuery (com.thinkaurelius.titan.diskstorage.keycolumnvalue.SliceQuery)1 EntryArrayList (com.thinkaurelius.titan.diskstorage.util.EntryArrayList)1