Skip to content

feat(pipeline)!: fetch selector roots in pages of 1000 - #1079

Open
ddeboer wants to merge 1 commit into
mainfrom
feat/selector-page-size
Open

ddeboer wants to merge 1 commit into
mainfrom
feat/selector-page-size

Conversation

@ddeboer

@ddeboer ddeboer commented Nov 14, 2026

Copy link
Copy Markdown
Member

Fix #1066

SparqlItemSelector paged roots in the stage’s batchSize, so a stage waited on a SELECT before every batch. It now fetches larger pages and the stage cuts them into batches.

  • New pageSize option. By default a page holds 1000 bindings, or the batchSize when that is larger. A LIMIT in the selector query still wins.
  • Each page is read in full before its first binding is yielded. A response is never held open while the stage extracts the page’s batches, and memory stays bounded by the page size.
  • The timeout policy now hears the outcome after the body is read. Before, it heard ok as soon as the headers arrived, so a body that failed halfway still counted as a success.
  • pageSize and batchSize must be positive integers. A query LIMIT 0 is rejected when the selector is built, not on its first run.
  • The SHACL sampler keeps one page per batch (pageSize: batchSize). Its selector caps results with maxResults, so a page of 1000 would fetch about 20 times the rows it yields.

Breaking: an endpoint that silently caps SELECT results below 1000 rows now stops pagination after the first page. Add a LIMIT to the selector query or set pageSize.

Not included: fetching the next page while the stage works through the current one. The stage still waits for one SELECT every 1000 roots.

- Give SparqlItemSelector a pageSize option, defaulting to the larger of the
  stage’s batchSize and 1000; the stage cuts each page into batches, so it no
  longer waits on a SELECT before every batch
- Read each page in full before yielding it, and report the outcome to the
  timeout policy after the body is read, so a failure mid-body counts as one
- Reject a non-integer pageSize or batchSize, and a query LIMIT 0 at
  construction
- Keep the SHACL sampler at one page per batch, so a sample fetches no rows it
  never yields

BREAKING CHANGE: SparqlItemSelector no longer pages in the stage’s batchSize.
An endpoint that silently caps SELECT results below 1000 rows now ends
pagination after the first page; add a LIMIT to the selector query or set
pageSize to stay under the cap.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetch roots in selector pages larger than the stage’s batchSize

1 participant