Skip to content

Commit d731024

Browse files
committed
working on new ID based join iterator
1 parent 60d77f0 commit d731024

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

core/sail/lmdb/src/main/java/org/eclipse/rdf4j/sail/lmdb/LmdbRecordIterator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private void initializeInternal(TripleIndex index, KeyBuilder keyBuilder, boolea
216216
if (keyBuilder != null) {
217217
keyBuilder.writeMax(maxKeyBuf);
218218
} else {
219-
index.getMaxKey(maxKeyBuf, subj, pred, obj, context);
219+
index.getMaxKey(maxKeyBuf, subj, pred, obj, context, prevSubj, prevPred, prevObj, prevContext);
220220
}
221221
maxKeyBuf.flip();
222222
this.maxKey.mv_data(maxKeyBuf);

core/sail/lmdb/src/main/java/org/eclipse/rdf4j/sail/lmdb/TripleStore.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ protected void filterUsedIds(Collection<Long> ids) throws IOException {
808808
GroupMatcher matcher = index.createMatcher(subj, pred, obj, context);
809809

810810
maxKeyBuf.clear();
811-
index.getMaxKey(maxKeyBuf, subj, pred, obj, context);
811+
index.getMaxKey(maxKeyBuf, subj, pred, obj, context, -1, -1, -1, -1);
812812
maxKeyBuf.flip();
813813
maxKey.mv_data(maxKeyBuf);
814814

@@ -906,7 +906,7 @@ private double estimateWithTransaction(Pool pool, Statistics statistics, MemoryS
906906
throws IOException {
907907
MDBVal maxKey = MDBVal.malloc(stack);
908908
ByteBuffer maxKeyBuf = stack.malloc(TripleStore.MAX_KEY_LENGTH);
909-
index.getMaxKey(maxKeyBuf, subj, pred, obj, context);
909+
index.getMaxKey(maxKeyBuf, subj, pred, obj, context, -1, -1, -1, -1);
910910
maxKeyBuf.flip();
911911
maxKey.mv_data(maxKeyBuf);
912912

@@ -1897,7 +1897,7 @@ public void writeMin(ByteBuffer buffer) {
18971897

18981898
@Override
18991899
public void writeMax(ByteBuffer buffer) {
1900-
getMaxKey(buffer, subj, pred, obj, context);
1900+
getMaxKey(buffer, subj, pred, obj, context, -1, -1, -1, -1);
19011901
}
19021902
};
19031903
}
@@ -1916,12 +1916,20 @@ void getMinKey(ByteBuffer bb, long subj, long pred, long obj, long context, long
19161916
toKey(bb, subj, pred, obj, context, prevSubjNorm, prevPredNorm, prevObjNorm, prevContextNorm);
19171917
}
19181918

1919-
void getMaxKey(ByteBuffer bb, long subj, long pred, long obj, long context) {
1919+
void getMaxKey(ByteBuffer bb, long subj, long pred, long obj, long context, long prevSubj, long prevPred,
1920+
long prevObj, long prevContext) {
19201921
subj = subj <= 0 ? Long.MAX_VALUE : subj;
19211922
pred = pred <= 0 ? Long.MAX_VALUE : pred;
19221923
obj = obj <= 0 ? Long.MAX_VALUE : obj;
19231924
context = context < 0 ? Long.MAX_VALUE : context;
1924-
toKey(bb, subj, pred, obj, context);
1925+
long prevSubjNorm = prevSubj == NO_PREVIOUS_ID ? NO_PREVIOUS_ID
1926+
: (prevSubj <= 0 ? Long.MAX_VALUE : prevSubj);
1927+
long prevPredNorm = prevPred == NO_PREVIOUS_ID ? NO_PREVIOUS_ID
1928+
: (prevPred <= 0 ? Long.MAX_VALUE : prevPred);
1929+
long prevObjNorm = prevObj == NO_PREVIOUS_ID ? NO_PREVIOUS_ID : (prevObj <= 0 ? Long.MAX_VALUE : prevObj);
1930+
long prevContextNorm = prevContext == NO_PREVIOUS_ID ? NO_PREVIOUS_ID
1931+
: (prevContext <= 0 ? Long.MAX_VALUE : prevContext);
1932+
toKey(bb, subj, pred, obj, context, prevSubjNorm, prevPredNorm, prevObjNorm, prevContextNorm);
19251933
}
19261934

19271935
GroupMatcher createMatcher(long subj, long pred, long obj, long context) {

0 commit comments

Comments
 (0)