Skip to content

fix: use native LanceDB pagination instead of full table load#18

Merged
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/native-pagination
Mar 16, 2026
Merged

fix: use native LanceDB pagination instead of full table load#18
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/native-pagination

Conversation

@gordonmurray
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the to_pylist() full-table-load pagination with LanceDB's native count_rows() + take_offsets(), reading only the requested page from disk
  • Falls back to Arrow slice() on older Lance versions that lack these methods
  • No frontend changes — response shape is identical

Version support

LanceDB Pagination method Verified
0.24.3 take_offsets() (native) Yes
0.16.0 Fallback (Arrow slice) No — should work
0.5 Fallback (Arrow slice) No — should work
0.3.4 Fallback (Arrow slice) Yes
0.3.1 Fallback (Arrow slice) No — should work

Test plan

  • Build and run with lancedb 0.24.3, paginate through a dataset, confirm rows load correctly
  • Verify column filtering still works with ?columns=col1,col2
  • Confirm offset beyond total rows returns empty result (not a crash)
  • Build with an older Lance version (e.g. 0.3.4) and confirm fallback works

Closes #13

Use count_rows() + take_offsets() to read only the requested page from disk, avoiding the full table load. Falls back to Arrow slice() on older Lance versions that lack these methods. Replaces the to_pylist() approach that converted the entire dataset to Python dicts before paginating.

Tested: lancedb 0.24.3 (native path), 0.3.4 (fallback path).
Untested: 0.16.0, 0.5, 0.3.1 — fallback should handle these.

Closes lance-format#13
@gordonmurray gordonmurray force-pushed the fix/native-pagination branch from 1652e5f to dc28500 Compare March 16, 2026 21:53
@gordonmurray gordonmurray mentioned this pull request Mar 16, 2026
@gordonmurray gordonmurray merged commit d83e2ec into lance-format:main Mar 16, 2026
12 checks passed
@gordonmurray gordonmurray deleted the fix/native-pagination branch March 16, 2026 21:57
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.

Support large tables

1 participant