Skip to content

feat(core): add UUIDv7 id-generation util + Python binding - #134

Merged
beinan merged 2 commits into
lance-format:mainfrom
beinan:rollout-uuid-util
Jul 14, 2026
Merged

beinan merged 2 commits into
lance-format:mainfrom
beinan:rollout-uuid-util

Conversation

@beinan

@beinan beinan commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a shared time-ordered id generator so callers default to sortable keys instead of fully-random v4.
  • lance_context_core::generate_id() -> String and new_uuid() -> Uuid, re-exported at the crate root.
  • Python: generate_id() pyfunction exposed as lance_context.generate_id.
  • UUIDv7 places a 48-bit Unix-ms timestamp in the high bits, so ids sort roughly in creation order — keeping appends clustered at an index tail rather than scattering them (friendlier to Lance's on-write indexing).

Notes

  • Same-millisecond and cross-process ordering is only approximate (sub-ms bits are random); no strict monotonicity guarantee.
  • Enables the v7 feature on the existing uuid dep in lance-context-core.

Test plan

  • cargo test -p lance-context-core id::tests (v7 round-trip, uniqueness, cross-ms sort order)
  • cargo build for the python crate
  • cargo fmt --all --check

🤖 Generated with Claude Code

beinan and others added 2 commits July 14, 2026 05:04
Records are keyed by caller-supplied string ids. Provide a shared
time-ordered id generator so callers default to sortable keys instead of
fully-random v4: `generate_id()` / `new_uuid()` in lance-context-core,
re-exported at the crate root, plus a `generate_id()` pyfunction exposed
as `lance_context.generate_id` in the Python package.

UUIDv7 puts a 48-bit Unix-ms timestamp in the high bits, so ids sort
roughly in creation order — keeping appends clustered at an index tail
rather than scattering them (friendlier to Lance's on-write indexing).

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Two blank lines after generate_id() and sort the _internal imports so
`generate_id` precedes `version`, per ruff.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@beinan
beinan merged commit db28a6e into lance-format:main Jul 14, 2026
9 checks passed
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.

1 participant