Search in sources :

Example 1 with LSMRTreeOpContext

use of org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeOpContext in project asterixdb by apache.

the class LSMRTreeTestWorker method performOp.

@Override
public void performOp(ITupleReference tuple, TestOperation op) throws HyracksDataException {
    LSMRTreeAccessor accessor = (LSMRTreeAccessor) indexAccessor;
    ITreeIndexCursor searchCursor = accessor.createSearchCursor(false);
    LSMRTreeOpContext concreteCtx = (LSMRTreeOpContext) accessor.getCtx();
    MultiComparator cmp = concreteCtx.getCurrentRTreeOpContext().getCmp();
    SearchPredicate rangePred = new SearchPredicate(tuple, cmp);
    switch(op) {
        case INSERT:
            rearrangeTuple(tuple, cmp);
            accessor.insert(rearrangedTuple);
            break;
        case DELETE:
            rearrangeTuple(tuple, cmp);
            accessor.delete(rearrangedTuple);
            break;
        case SCAN:
            searchCursor.reset();
            rangePred.setSearchKey(null);
            accessor.search(searchCursor, rangePred);
            consumeCursorTuples(searchCursor);
            break;
        case MERGE:
            accessor.scheduleMerge(NoOpIOOperationCallbackFactory.INSTANCE.createIoOpCallback(), lsmRTree.getImmutableComponents());
            break;
        default:
            throw new HyracksDataException("Op " + op.toString() + " not supported.");
    }
}
Also used : ITreeIndexCursor(org.apache.hyracks.storage.am.common.api.ITreeIndexCursor) LSMRTreeAccessor(org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeAccessor) LSMRTreeOpContext(org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeOpContext) MultiComparator(org.apache.hyracks.storage.common.MultiComparator) SearchPredicate(org.apache.hyracks.storage.am.rtree.impls.SearchPredicate) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 2 with LSMRTreeOpContext

use of org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeOpContext in project asterixdb by apache.

the class LSMRTreeWithAntiMatterTuplesTestWorker method performOp.

@Override
public void performOp(ITupleReference tuple, TestOperation op) throws HyracksDataException {
    LSMTreeIndexAccessor accessor = (LSMTreeIndexAccessor) indexAccessor;
    ITreeIndexCursor searchCursor = accessor.createSearchCursor(false);
    LSMRTreeOpContext concreteCtx = (LSMRTreeOpContext) accessor.getCtx();
    MultiComparator cmp = concreteCtx.getCurrentRTreeOpContext().getCmp();
    SearchPredicate rangePred = new SearchPredicate(tuple, cmp);
    switch(op) {
        case INSERT:
            rearrangeTuple(tuple, cmp);
            accessor.insert(rearrangedTuple);
            break;
        case DELETE:
            rearrangeTuple(tuple, cmp);
            accessor.delete(rearrangedTuple);
            break;
        case SCAN:
            searchCursor.reset();
            rangePred.setSearchKey(null);
            accessor.search(searchCursor, rangePred);
            consumeCursorTuples(searchCursor);
            break;
        case MERGE:
            accessor.scheduleMerge(NoOpIOOperationCallbackFactory.INSTANCE.createIoOpCallback(), ((AbstractLSMRTree) lsmRTree).getImmutableComponents());
            break;
        default:
            throw new HyracksDataException("Op " + op.toString() + " not supported.");
    }
}
Also used : ITreeIndexCursor(org.apache.hyracks.storage.am.common.api.ITreeIndexCursor) LSMRTreeOpContext(org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeOpContext) MultiComparator(org.apache.hyracks.storage.common.MultiComparator) LSMTreeIndexAccessor(org.apache.hyracks.storage.am.lsm.common.impls.LSMTreeIndexAccessor) SearchPredicate(org.apache.hyracks.storage.am.rtree.impls.SearchPredicate) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)2 ITreeIndexCursor (org.apache.hyracks.storage.am.common.api.ITreeIndexCursor)2 LSMRTreeOpContext (org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeOpContext)2 SearchPredicate (org.apache.hyracks.storage.am.rtree.impls.SearchPredicate)2 MultiComparator (org.apache.hyracks.storage.common.MultiComparator)2 LSMTreeIndexAccessor (org.apache.hyracks.storage.am.lsm.common.impls.LSMTreeIndexAccessor)1 LSMRTreeAccessor (org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeAccessor)1