Search in sources :

Example 6 with ISearchOperationCallback

use of org.apache.hyracks.storage.common.ISearchOperationCallback in project asterixdb by apache.

the class ExternalBTreeSearchOperatorNodePushable method open.

// We override the open function to search a specific version of the index
@Override
public void open() throws HyracksDataException {
    writer.open();
    accessor = new FrameTupleAccessor(inputRecDesc);
    indexHelper.open();
    index = indexHelper.getIndexInstance();
    if (retainMissing) {
        int fieldCount = getFieldCount();
        nonMatchTupleBuild = new ArrayTupleBuilder(fieldCount);
        DataOutput out = nonMatchTupleBuild.getDataOutput();
        for (int i = 0; i < fieldCount; i++) {
            try {
                nonMatchWriter.writeMissing(out);
            } catch (IOException e) {
                e.printStackTrace();
            }
            nonMatchTupleBuild.addFieldEndOffset();
        }
    } else {
        nonMatchTupleBuild = null;
    }
    ExternalBTreeWithBuddy externalIndex = (ExternalBTreeWithBuddy) index;
    try {
        searchPred = createSearchPredicate();
        tb = new ArrayTupleBuilder(recordDesc.getFieldCount());
        dos = tb.getDataOutput();
        appender = new FrameTupleAppender(new VSizeFrame(ctx));
        ISearchOperationCallback searchCallback = searchCallbackFactory.createSearchOperationCallback(indexHelper.getResource().getId(), ctx, null);
        // The next line is the reason we override this method
        indexAccessor = externalIndex.createAccessor(searchCallback, version);
        cursor = createCursor();
        if (retainInput) {
            frameTuple = new FrameTupleReference();
        }
    } catch (Throwable th) {
        throw new HyracksDataException(th);
    }
}
Also used : DataOutput(java.io.DataOutput) FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) ExternalBTreeWithBuddy(org.apache.hyracks.storage.am.lsm.btree.impls.ExternalBTreeWithBuddy) FrameTupleReference(org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference) ArrayTupleBuilder(org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder) IOException(java.io.IOException) ISearchOperationCallback(org.apache.hyracks.storage.common.ISearchOperationCallback) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) FrameTupleAccessor(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)

Aggregations

ISearchOperationCallback (org.apache.hyracks.storage.common.ISearchOperationCallback)6 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)5 VSizeFrame (org.apache.hyracks.api.comm.VSizeFrame)4 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)4 FrameTupleAppender (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender)4 DataOutput (java.io.DataOutput)3 IOException (java.io.IOException)3 FrameTupleAccessor (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)3 FrameTupleReference (org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference)3 IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)1 IOperatorNodePushable (org.apache.hyracks.api.dataflow.IOperatorNodePushable)1 ArrayTupleReference (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference)1 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)1 RangePredicate (org.apache.hyracks.storage.am.btree.impls.RangePredicate)1 ISearchOperationCallbackFactory (org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory)1 ITreeIndex (org.apache.hyracks.storage.am.common.api.ITreeIndex)1 ITreeIndexAccessor (org.apache.hyracks.storage.am.common.api.ITreeIndexAccessor)1 ITreeIndexCursor (org.apache.hyracks.storage.am.common.api.ITreeIndexCursor)1 ITreeIndexFrame (org.apache.hyracks.storage.am.common.api.ITreeIndexFrame)1 TreeIndexDiskOrderScanCursor (org.apache.hyracks.storage.am.common.impls.TreeIndexDiskOrderScanCursor)1