Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugs in list codec when dealing with a list of empty lists or multiple lists in a single page #2222

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

westonpace
Copy link
Contributor

No description provided.

with mutliple lists being written to a single page.  Rework testing
infrastructure to make it easy to write new tests with specific cases.
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.95973% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 81.17%. Comparing base (bc89dcb) to head (ef927b0).

Files Patch % Lines
rust/lance-encoding/src/testing.rs 93.30% 11 Missing and 3 partials ⚠️
rust/lance-encoding/src/encodings/logical/list.rs 93.93% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2222      +/-   ##
==========================================
+ Coverage   81.15%   81.17%   +0.01%     
==========================================
  Files         185      185              
  Lines       53508    53641     +133     
  Branches    53508    53641     +133     
==========================================
+ Hits        43425    43543     +118     
- Misses       7609     7620      +11     
- Partials     2474     2478       +4     
Flag Coverage Δ
unittests 81.17% <93.95%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got question about one particular case. otherwise, looks good.

Comment on lines +461 to +466
// The first offset doesn't have to be 0 (this happens when lists are sliced)
//
// So if the previous offsets are [0, 3, 5] and the current offsets are
// [10, 11, 12] then we want to add 5 - 10 to all of the current offsets
// (skipping the first) to get [6, 7] and then append them to the previous
// offsets to get [0, 3, 5, 6, 7]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we handling the case where the first set of offsets doesn't start at 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and the slicing tests in random will test this.

let list_array = list_builder.finish();

let test_cases = TestCases::default().with_range(0..2).with_indices(vec![1]);
check_round_trip_encoding_of_data(vec![Arc::new(list_array)], &test_cases).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should check various slicing patterns here? That is, something like:

Suggested change
check_round_trip_encoding_of_data(vec![Arc::new(list_array)], &test_cases).await;
check_round_trip_encoding_of_data(vec![Arc::new(list_array)], &test_cases).await;
check_round_trip_encoding_of_data(vec![Arc::new(list_array).slice(3, 0)], &test_cases).await;
check_round_trip_encoding_of_data(vec![Arc::new(list_array).slice(2, 0), Arc::new(list_array).slice(1, 3)], &test_cases).await;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like this might be covered in check_round_trip_field_encoding_random. If so, ignore this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep :)

@westonpace westonpace merged commit a2ef6f5 into lancedb:main Apr 24, 2024
17 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.

None yet

3 participants