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.");
}
}
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.");
}
}
Aggregations