fix: stop pushing SPARQL LIMIT into child algebra nodes

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:
Cyber MacGeddon 2026-05-21 11:29:37 +01:00
parent 2c3a699af3
commit 935dedb2bf

View file

@ -262,13 +262,7 @@ async def _eval_order_by(node, tc, collection, limit):
async def _eval_slice(node, tc, collection, limit): async def _eval_slice(node, tc, collection, limit):
"""Evaluate a Slice node (LIMIT/OFFSET).""" """Evaluate a Slice node (LIMIT/OFFSET)."""
# Pass tighter limit downstream if possible solutions = await evaluate(node.p, tc, collection, limit)
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)
return slice_solutions(solutions, node.start or 0, node.length) return slice_solutions(solutions, node.start or 0, node.length)