fix: stop pushing SPARQL LIMIT into child algebra nodes (#946)

The Slice evaluator was propagating the SPARQL LIMIT value as the
inner limit for child evaluations, starving LeftJoin (OPTIONAL) and
other operators of results. The safety limit parameter should flow
through unchanged; LIMIT/OFFSET are applied only at the Slice node.
This commit is contained in:
cybermaggedon 2026-05-21 12:24:38 +01:00 committed by GitHub
parent 2c3a699af3
commit 81e9a3ebe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,13 +262,7 @@ async def _eval_order_by(node, tc, collection, limit):
async def _eval_slice(node, tc, collection, limit):
"""Evaluate a Slice node (LIMIT/OFFSET)."""
# Pass tighter limit downstream if possible
inner_limit = limit
if node.length is not None:
offset = node.start or 0
inner_limit = min(limit, offset + node.length)
solutions = await evaluate(node.p, tc, collection, inner_limit)
solutions = await evaluate(node.p, tc, collection, limit)
return slice_solutions(solutions, node.start or 0, node.length)