public boolean subsumes(SliceQuery oth) { Preconditions.checkNotNull(oth); if (this == oth) return true; if (oth.getLimit() > getLimit()) return false; else if (!hasLimit()) //the interval must be subsumed return sliceStart.compareTo(oth.sliceStart) <= 0 && sliceEnd.compareTo(oth.sliceEnd) >= 0; else //this the result might be cutoff due to limit, the start must be the same return sliceStart.compareTo(oth.sliceStart) == 0 && sliceEnd.compareTo(oth.sliceEnd) >= 0; }
public EntryList getSubset(final SliceQuery otherQuery, final EntryList otherResult) { assert otherQuery.subsumes(this); int pos = Collections.binarySearch(otherResult, sliceStart); if (pos < 0) pos = -pos - 1; final List<Entry> result = new ArrayList<>(); for (; pos < otherResult.size() && result.size() < getLimit(); pos++) { Entry e = otherResult.get(pos); if (e.getColumnAs(StaticBuffer.STATIC_FACTORY).compareTo(sliceEnd) < 0) result.add(e); else break; } return StaticArrayEntryList.of(result); }
int upperID = local.getEnd().getInt(0) >>> backShift; //upper id is exclusive if ((local.getStart().compareTo(local.getEnd())<0 && lowerID>=upperID)) { discardRange(local); continue;
@Override public KeyIterator getKeys(final KeyRangeQuery keyQuery, final StoreTransaction txh) throws BackendException { final KVQuery query = new KVQuery( concatenatePrefix(adjustToLength(keyQuery.getKeyStart()), keyQuery.getSliceStart()), concatenatePrefix(adjustToLength(keyQuery.getKeyEnd()), keyQuery.getSliceEnd()), keycolumn -> { final StaticBuffer key = getKey(keycolumn); return !(key.compareTo(keyQuery.getKeyStart()) < 0 || key.compareTo(keyQuery.getKeyEnd()) >= 0) && columnInRange(keycolumn, keyQuery.getSliceStart(), keyQuery.getSliceEnd()); }, BaseQuery.NO_LIMIT); //limit will be introduced in iterator return new KeyIteratorImpl(keyQuery,store.getSlice(query,txh)); }
sliceStart = IDHandler.getRelationType(type.longId(), getDirID(Direction.OUT, rt), type.isInvisibleType()); sliceEnd = IDHandler.getRelationType(type.longId(), getDirID(Direction.IN, rt), type.isInvisibleType()); assert sliceStart.compareTo(sliceEnd)<0; sliceEnd = BufferUtil.nextBiggerBuffer(sliceEnd); } else { assert sliceStart.compareTo(sliceEnd)<=0; break;
public Entry build(final StaticBuffer column) { if (null == item || null == column) { return null; } final AttributeValue valueValue = item.get(Constants.JANUSGRAPH_VALUE); final StaticBuffer value = decodeValue(valueValue); // DynamoDB's between semantics include the end of a slice, but Titan expects the end to be exclusive if (slice && column.compareTo(end) == 0) { return null; } return StaticArrayEntry.of(column, value); }