Skip to content

Commit 07ed8e5

Browse files
anidotnetclaude
andcommitted
Don't reassign sortAndBound's parameter
The extraction carried the old method's accumulate-into-rawStream shape into a parameter. A local makes the stage read as what it is: a chain that wraps the source and returns it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9f58759 commit 07ed8e5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎nitrite/src/main/java/org/dizitart/no2/collection/operation/ReadOperations.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,21 +290,22 @@ private RecordStream<Pair<NitriteId, Document>> sortAndBound(
290290
if (rawStream == null) {
291291
return null;
292292
}
293+
RecordStream<Pair<NitriteId, Document>> stream = rawStream;
293294

294295
// the blocking sort still runs whenever the ordered ids were not used - either no
295296
// index could answer the sort, or the one that could turned out not to cover the
296297
// collection faithfully
297298
if (!sortedByIndex && findPlan.getBlockingSortOrder() != null
298299
&& !findPlan.getBlockingSortOrder().isEmpty()) {
299-
rawStream = new SortedDocumentStream(findPlan, rawStream);
300+
stream = new SortedDocumentStream(findPlan, stream);
300301
}
301302

302303
if (findPlan.getLimit() != null || findPlan.getSkip() != null) {
303304
long limit = findPlan.getLimit() == null ? Long.MAX_VALUE : findPlan.getLimit();
304305
long skip = findPlan.getSkip() == null ? 0 : findPlan.getSkip();
305-
rawStream = new BoundedStream<>(skip, limit, rawStream);
306+
stream = new BoundedStream<>(skip, limit, stream);
306307
}
307308

308-
return rawStream;
309+
return stream;
309310
}
310311
}

0 commit comments

Comments
 (0)