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

[ENH] Comparison (LT, GT, LTE, GTE) and prefix operations on arrow blockfile #2223

Merged
merged 14 commits into from
May 23, 2024

Conversation

sanketkedia
Copy link
Contributor

Description of changes

Summarize the changes made by this PR.

  • New functionality
    • Adds gets for LT, GT, LTE, GTE and get by prefix for arrow blockfile

Test plan

Unit-tests in arrow blockfile

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

None

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chroma ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 6:59am

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Member

@beggers beggers left a comment

Choose a reason for hiding this comment

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

This looks good -- sorry my previous comment made you think through all this fiddly logic but I think it's correct now. A couple small questions to make sure I'm reading the code correctly.

while let Some((curr_key, curr_uuid)) = curr_iter.next() {
let non_start_curr_key: Option<&CompositeKey>;
match curr_key {
SparseIndexDelimiter::Start => non_start_curr_key = None,
Copy link
Member

Choose a reason for hiding this comment

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

We might be able to simplify this by setting non_start_curr_key to "" if we're at the start so that every prefix is > it, right? I'm not asking for this change; partly saying this to make sure I'm correctly understanding what we're doing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For prefix yes. But then for the actual key it becomes complicated depending on the type. Honestly, I feel we should remove this enum that treats start separately from everything else. and instead have default values like you are suggesting

Copy link
Collaborator

Choose a reason for hiding this comment

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

Strongly prefer an explicit start over defaults that implicitly represent some contract. We could modify the iteration scheme to make start not a factor.

} else {
// Last block.
if non_start_curr_key.is_none()
|| prefix >= non_start_curr_key.unwrap().prefix.as_str()
Copy link
Member

Choose a reason for hiding this comment

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

To make sure I understand: this means that if there's one block in the blockfile we always load and query it, right?

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! that's the first part of the OR block

block_ids.push(*curr_uuid);
}
}
if curr_key.is_some() && curr_key.unwrap().prefix.as_str() == prefix {
Copy link
Member

Choose a reason for hiding this comment

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

I can see why you wanted a thorough review on this. This looks correct to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In hindsight this could be a good coding question to test ability to think through cases

@sanketkedia sanketkedia merged commit c81130d into main May 23, 2024
47 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