Search in sources :

Example 1 with InMemoryInvertedIndex

use of org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndex in project asterixdb by apache.

the class LSMInvertedIndex method createCursorInitialState.

private ICursorInitialState createCursorInitialState(ISearchPredicate pred, IIndexOperationContext ictx, boolean includeMutableComponent, ArrayList<IIndexAccessor> indexAccessors, ArrayList<IIndexAccessor> deletedKeysBTreeAccessors, List<ILSMComponent> operationalComponents) {
    ICursorInitialState initState;
    PermutingTupleReference keysOnlyTuple = createKeysOnlyTupleReference();
    MultiComparator keyCmp = MultiComparator.create(invListCmpFactories);
    // Distinguish between regular searches and range searches (mostly used in merges).
    if (pred instanceof InvertedIndexSearchPredicate) {
        initState = new LSMInvertedIndexSearchCursorInitialState(keyCmp, keysOnlyTuple, indexAccessors, deletedKeysBTreeAccessors, ((LSMInvertedIndexMemoryComponent) memoryComponents.get(currentMutableComponentId.get())).getDeletedKeysBTree().getLeafFrameFactory(), ictx, includeMutableComponent, getLsmHarness(), operationalComponents);
    } else {
        LSMInvertedIndexMemoryComponent mutableComponent = (LSMInvertedIndexMemoryComponent) memoryComponents.get(currentMutableComponentId.get());
        InMemoryInvertedIndex memInvIndex = (InMemoryInvertedIndex) mutableComponent.getInvIndex();
        MultiComparator tokensAndKeysCmp = MultiComparator.create(memInvIndex.getBTree().getComparatorFactories());
        initState = new LSMInvertedIndexRangeSearchCursorInitialState(tokensAndKeysCmp, keyCmp, keysOnlyTuple, ((LSMInvertedIndexMemoryComponent) memoryComponents.get(currentMutableComponentId.get())).getDeletedKeysBTree().getLeafFrameFactory(), includeMutableComponent, getLsmHarness(), indexAccessors, deletedKeysBTreeAccessors, pred, operationalComponents);
    }
    return initState;
}
Also used : PermutingTupleReference(org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference) ICursorInitialState(org.apache.hyracks.storage.common.ICursorInitialState) MultiComparator(org.apache.hyracks.storage.common.MultiComparator) InvertedIndexSearchPredicate(org.apache.hyracks.storage.am.lsm.invertedindex.search.InvertedIndexSearchPredicate) InMemoryInvertedIndex(org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndex)

Aggregations

PermutingTupleReference (org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference)1 InMemoryInvertedIndex (org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndex)1 InvertedIndexSearchPredicate (org.apache.hyracks.storage.am.lsm.invertedindex.search.InvertedIndexSearchPredicate)1 ICursorInitialState (org.apache.hyracks.storage.common.ICursorInitialState)1 MultiComparator (org.apache.hyracks.storage.common.MultiComparator)1