Search in sources :

Example 1 with LSMRTreeAccessor

use of org.apache.hyracks.storage.am.lsm.rtree.impls.LSMRTreeAccessor 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)

Aggregations

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