public LSMRTreeSearchCursor(ILSMIndexOperationContext opCtx, int[] buddyBTreeFields) { super(opCtx); currentCursor = 0; this.btreeTuple = new PermutingTupleReference(buddyBTreeFields); }
public LSMBTreeWithBuddySearchCursor(ILSMIndexOperationContext opCtx, int[] buddyBTreeFields) { super(opCtx); currentCursor = 0; this.buddyBTreeTuple = new PermutingTupleReference(buddyBTreeFields); }
/** * Returns a permuting tuple reference that projects away the document field(s) of a tuple, only leaving the key * fields. */ private PermutingTupleReference createKeysOnlyTupleReference() { // Project away token fields. int[] keyFieldPermutation = new int[invListTypeTraits.length]; int numTokenFields = tokenTypeTraits.length; for (int i = 0; i < invListTypeTraits.length; i++) { keyFieldPermutation[i] = numTokenFields + i; } return new PermutingTupleReference(keyFieldPermutation); }
public FilterBulkLoader(ILSMComponentFilter filter, ITreeIndex treeIndex, ILSMComponentFilterManager filterManager, int[] indexFields, int[] filterFields, MultiComparator filterCmp) { this.filter = filter; this.treeIndex = treeIndex; this.filterManager = filterManager; this.indexTuple = new PermutingTupleReference(indexFields); this.filterTuple = new PermutingTupleReference(filterFields); this.filterCmp = filterCmp; }
public DualTupleReference(int[] fieldPermutation) { permutingTuple = new PermutingTupleReference(fieldPermutation); }
public LSMBTreeWithBuddySortedCursor(ILSMIndexOperationContext opCtx, int[] buddyBTreeFields) throws HyracksDataException { super(opCtx); this.buddyBtreeTuple = new PermutingTupleReference(buddyBTreeFields); close(); }
public LSMRTreeSortedCursor(ILSMIndexOperationContext opCtx, ILinearizeComparatorFactory linearizer, int[] buddyBTreeFields) throws HyracksDataException { super(opCtx); this.linearizeCmp = linearizer.createBinaryComparator(); this.btreeTuple = new PermutingTupleReference(buddyBTreeFields); close(); }
public AbstractLSMIndexOperationContext(ILSMIndex index, int[] treeFields, int[] filterFields, IBinaryComparatorFactory[] filterCmpFactories, ISearchOperationCallback searchCallback, IExtendedModificationOperationCallback modificationCallback, ITracer tracer) { this.index = index; this.searchCallback = searchCallback; this.modificationCallback = modificationCallback; this.componentHolder = new ArrayList<>(); this.componentsToBeMerged = new ArrayList<>(); this.componentsToBeReplicated = new ArrayList<>(); if (filterFields != null) { indexTuple = new PermutingTupleReference(treeFields); filterCmp = MultiComparator.create(filterCmpFactories); filterTuple = new PermutingTupleReference(filterFields); } else { indexTuple = null; filterCmp = null; filterTuple = null; } this.tracer = tracer; this.traceCategory = tracer.getRegistry().get(TraceUtils.INDEX_OPERATIONS); }
public InMemoryInvertedListCursor(int invListFieldCount, int tokenFieldCount) { int[] fieldPermutation = new int[invListFieldCount]; for (int i = 0; i < invListFieldCount; i++) { fieldPermutation[i] = tokenFieldCount + i; } resultTuple = new PermutingTupleReference(fieldPermutation); // Concatenating the tuple with tokens, and the tuple with inverted-list elements. btreeSearchTuple = new ConcatenatingTupleReference(2); tokenTupleBuilder = new ArrayTupleBuilder(tokenFieldCount); }
public LSMInvertedIndexOpContext(ILSMIndex index, List<ILSMMemoryComponent> mutableComponents, IIndexAccessParameters iap, int[] invertedIndexFields, int[] filterFields, IBinaryComparatorFactory[] filterComparatorFactories, ITracer tracer) throws HyracksDataException { super(index, invertedIndexFields, filterFields, filterComparatorFactories, iap.getSearchOperationCallback(), (IExtendedModificationOperationCallback) iap.getModificationCallback(), tracer); mutableInvIndexAccessors = new IInvertedIndexAccessor[mutableComponents.size()]; deletedKeysBTreeAccessors = new IIndexAccessor[mutableComponents.size()]; for (int i = 0; i < mutableComponents.size(); i++) { LSMInvertedIndexMemoryComponent mutableComponent = (LSMInvertedIndexMemoryComponent) mutableComponents.get(i); mutableInvIndexAccessors[i] = mutableComponent.getIndex().createAccessor(NoOpIndexAccessParameters.INSTANCE); deletedKeysBTreeAccessors[i] = mutableComponent.getBuddyIndex().createAccessor(NoOpIndexAccessParameters.INSTANCE); } // Project away the document fields, leaving only the key fields. LSMInvertedIndexMemoryComponent c = (LSMInvertedIndexMemoryComponent) mutableComponents.get(0); int numKeyFields = c.getIndex().getInvListTypeTraits().length; int[] keyFieldPermutation = new int[numKeyFields]; for (int i = 0; i < numKeyFields; i++) { keyFieldPermutation[i] = NUM_DOCUMENT_FIELDS + i; } keysOnlyTuple = new PermutingTupleReference(keyFieldPermutation); this.iap = iap; }
public LSMSecondaryIndexBulkLoadNodePushable(IHyracksTaskContext ctx, int partition, RecordDescriptor inputRecDesc, IIndexDataflowHelperFactory primaryIndexHelperFactory, IIndexDataflowHelperFactory secondaryIndexHelperFactory, int[] fieldPermutation, int numTagFields, int numSecondaryKeys, int numPrimaryKeys, boolean hasBuddyBTree) throws HyracksDataException { super(ctx, partition, inputRecDesc, numTagFields, numSecondaryKeys, numPrimaryKeys, hasBuddyBTree); this.primaryIndexHelper = primaryIndexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); this.secondaryIndexHelper = secondaryIndexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); this.tuple = new PermutingFrameTupleReference(fieldPermutation); int[] sourcePermutation = new int[fieldPermutation.length - numTagFields]; for (int i = 0; i < sourcePermutation.length; i++) { sourcePermutation[i] = i + numTagFields; } sourceTuple = new PermutingTupleReference(sourcePermutation); int[] deletedKeyPermutation = new int[inputRecDesc.getFieldCount() - numTagFields - numSecondaryKeys]; for (int i = 0; i < deletedKeyPermutation.length; i++) { deletedKeyPermutation[i] = i + numTagFields + numSecondaryKeys; } deletedKeyTuple = new PermutingTupleReference(deletedKeyPermutation); }
public OnDiskInvertedIndexRangeSearchCursor(OnDiskInvertedIndex invIndex, IIndexOperationContext opCtx) throws HyracksDataException { this.btree = invIndex.getBTree(); this.btreeAccessor = btree.createAccessor(NoOpIndexAccessParameters.INSTANCE); this.invIndex = invIndex; this.opCtx = opCtx; // Project away non-token fields of the BTree tuples. int[] fieldPermutation = new int[invIndex.getTokenTypeTraits().length]; for (int i = 0; i < invIndex.getTokenTypeTraits().length; i++) { fieldPermutation[i] = i; } tokenTuple = new PermutingTupleReference(fieldPermutation); btreeCursor = btreeAccessor.createSearchCursor(false); resultTuple = new TokenKeyPairTuple(invIndex.getTokenTypeTraits().length, btree.getCmpFactories().length); invListRangeSearchCursor = invIndex.createInvertedListRangeSearchCursor(); isInvListCursorOpen = false; }
private void setMatterTuple(ITupleReference diskTuple, int cursorIndex) throws HyracksDataException { if (tupleBuilder == null) { tupleBuilder = new ArrayTupleBuilder(diskTuple.getFieldCount() + 2); antiMatterTupleBuilder = new ArrayTupleBuilder(diskTuple.getFieldCount() + 2); int[] permutation = new int[diskTuple.getFieldCount()]; for (int i = 0; i < permutation.length; i++) { permutation[i] = i + 2; } originalTuple = new PermutingTupleReference(permutation); } //build the matter tuple buildTuple(tupleBuilder, diskTuple, cursorIndex, MATTER_TUPLE_FLAG); outputTuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray()); originalTuple.reset(outputTuple); }
protected void checkReturnedTuple(OrderedIndexTestContext ctx, ITupleReference tuple, ISerializerDeserializer[] fieldSerdes, int componentPos, boolean antimatter, Object value) throws HyracksDataException { int actualComponentPos = IntegerPointable.getInteger(tuple.getFieldData(0), tuple.getFieldStart(0)); Assert.assertEquals("Check returned component position", componentPos, actualComponentPos); boolean actualAntiMatter = BooleanPointable.getBoolean(tuple.getFieldData(1), tuple.getFieldStart(1)); Assert.assertEquals("Check returned anti-matter flag", antimatter, actualAntiMatter); int[] permutation = new int[ctx.getFieldCount()]; for (int i = 0; i < permutation.length; i++) { permutation[i] = i + 2; } PermutingTupleReference originalTuple = new PermutingTupleReference(permutation); originalTuple.reset(tuple); for (int i = 0; i < fieldSerdes.length; i++) { ByteArrayInputStream inStream = new ByteArrayInputStream(originalTuple.getFieldData(i), originalTuple.getFieldStart(i), originalTuple.getFieldLength(i)); DataInput dataIn = new DataInputStream(inStream); Object actualObj = fieldSerdes[i].deserialize(dataIn); if (!actualObj.equals(value)) { fail("Actual and expected fields do not match on field " + i + ".\nExpected: " + value + "\nActual : " + actualObj); } } }
fieldPermutation[i] = i; PermutingTupleReference tokenTuple = new PermutingTupleReference(fieldPermutation); IIndexOperationContext opCtx = new OnDiskInvertedIndexOpContext(btree);