From 935dedb2bf43b89ef79920244dfd7ee839a1b9b2 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Thu, 21 May 2026 11:29:37 +0100 Subject: [PATCH] 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. --- trustgraph-flow/trustgraph/query/sparql/algebra.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/trustgraph-flow/trustgraph/query/sparql/algebra.py b/trustgraph-flow/trustgraph/query/sparql/algebra.py index 6f0227c8..d0f7d05e 100644 --- a/trustgraph-flow/trustgraph/query/sparql/algebra.py +++ b/trustgraph-flow/trustgraph/query/sparql/algebra.py @@ -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)