Skip to content

fix(encoding): improve dict sampling for sorted strings#7159

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/fix-sorted-dict-sampling
Jun 9, 2026
Merged

fix(encoding): improve dict sampling for sorted strings#7159
Xuanwo merged 1 commit into
mainfrom
xuanwo/fix-sorted-dict-sampling

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix dictionary encoding selection for sorted low-cardinality string data by replacing stride-based near-unique sampling with deterministic block sampling.

The previous stride sampler could sample one value from each sorted run and classify low-cardinality data as near-unique, causing Lance to skip dictionary encoding. The new sampling path also projects sampled cardinality against the dictionary budget so sorted high-cardinality short runs do not fall into an expensive full-page dictionary probe.

Closes #6941.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer bug Something isn't working labels Jun 8, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review June 8, 2026 17:18
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../lance-encoding/src/encodings/logical/primitive.rs 94.44% 5 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Xuanwo
Xuanwo merged commit bd4ed80 into main Jun 9, 2026
33 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/fix-sorted-dict-sampling branch June 9, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String compression: Lance is 5-350x larger than Parquet on low-cardinality columns

2 participants