Skip to content

fix(local): apply offset to prefetched random samples - #1594

Draft
Harsh23Kashyap wants to merge 1 commit into
qdrant:devfrom
Harsh23Kashyap:fix/local-prefetched-sample-offset
Draft

Harsh23Kashyap wants to merge 1 commit into
qdrant:devfrom
Harsh23Kashyap:fix/local-prefetched-sample-offset

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown

Fixes #1593.

Local random sampling ignores offset even when it follows a prefetch. With five candidates and offset=5, local mode returns five points while Qdrant 1.19.2 returns none.

Apply the offset after sampling the prefetched candidates, requesting limit + offset points before slicing. Standalone random queries still ignore offset, as the server does. Other query types keep their existing offset handling.

Sync and async regressions cover offsets 0, 2, 4, 5 and 10, with and without a prefetch. Before the fix, six assertions fail and fourteen pass on both runs (1.09s, 1.08s). After the fix, all twenty pass twice (1.02s, 0.96s).

Also ran:

  • pytest qdrant_client/local/tests tests/test_local_persistence.py tests/test_local_uuid_identity.py tests/test_local_sample_offset.py -q: 271 passed twice (4.19s, 3.72s).
  • Separate filtered/nested-prefetch/standalone probes against a disposable Qdrant 1.19.2 server, sync and async over REST and gRPC: 40 cases passed per run, twice. The corresponding patched local probes pass twice. These check result counts, unique IDs, filter membership, payload and vectors, not random ordering.
  • Ruff check/format and the repository's pre-commit hooks pass for both changed files.

I did not run the full repository or model-inference suites. Python 3.12.14, Linux x86_64.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 20bfbb1
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6ad20c93018552527bca5b82
😎 Deploy Preview https://deploy-preview-1594--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

2 participants