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

feat(relational_iter): add state_table_iter with pk_prefix and pk_bounds #3008

Merged
merged 10 commits into from
Jun 8, 2022

Conversation

wcy-fdu
Copy link
Contributor

@wcy-fdu wcy-fdu commented Jun 6, 2022

What's changed and what's your intention?

This PR adds with_prefix and with_pk_bounds for StateTableIter, the former can be used while refactoring join with relational table.
For example, a table with pk
(a, b)
(1, 1)
(1, 2)
(2, 1)
(2, 2)
(3, 1)
(3, 2)
iter(a = 2) will scan (2, 1), (2, 2), iter(a > 2) will scan (2, 1), (2, 2), (3, 1), (3, 2).

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

close #2811

@wcy-fdu wcy-fdu marked this pull request as draft June 6, 2022 10:45
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 824 files.

Valid Invalid Ignored Fixed
822 1 1 0
Click to see the invalid file list
  • src/frontend/test_runner/tests/gen/testcases.rs

src/frontend/test_runner/tests/gen/testcases.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 6, 2022

Codecov Report

Merging #3008 (bc47770) into main (408e9fb) will increase coverage by 0.14%.
The diff coverage is 97.72%.

@@            Coverage Diff             @@
##             main    #3008      +/-   ##
==========================================
+ Coverage   73.26%   73.40%   +0.14%     
==========================================
  Files         731      731              
  Lines       98441    99012     +571     
==========================================
+ Hits        72124    72682     +558     
- Misses      26317    26330      +13     
Flag Coverage Δ
rust 73.40% <97.72%> (+0.14%) ⬆️

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

Impacted Files Coverage Δ
src/storage/src/table/state_table.rs 88.12% <87.34%> (-0.77%) ⬇️
src/storage/src/keyspace.rs 76.57% <92.00%> (+4.48%) ⬆️
src/storage/src/table/test_relational_table.rs 98.21% <99.77%> (+0.47%) ⬆️
src/common/src/array/data_chunk_iter.rs 86.00% <100.00%> (+0.14%) ⬆️
src/storage/src/table/cell_based_table.rs 90.69% <100.00%> (+0.45%) ⬆️
src/meta/src/model/barrier.rs 78.57% <0.00%> (-3.58%) ⬇️
src/meta/src/barrier/mod.rs 69.45% <0.00%> (+0.32%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

btw, how to represent a prefix scan? e.g., pk=[a,b], scan a=1

@wcy-fdu wcy-fdu marked this pull request as ready for review June 7, 2022 05:46
@wcy-fdu wcy-fdu changed the title feat(relational_iter): add tate_table_iter with pk bounds feat(relational_iter): add tate_table_iter with pk_prefix and pk bounds Jun 7, 2022
@wcy-fdu wcy-fdu requested a review from st1page June 7, 2022 05:49
@wcy-fdu wcy-fdu requested a review from fuyufjh June 7, 2022 06:52
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

Generally LGTM

src/storage/src/table/state_table.rs Outdated Show resolved Hide resolved
@xxchan xxchan mentioned this pull request Jun 7, 2022
3 tasks
@wcy-fdu wcy-fdu changed the title feat(relational_iter): add tate_table_iter with pk_prefix and pk bounds feat(relational_iter): add state_table_iter with pk_prefix and pk_bounds Jun 8, 2022
@wcy-fdu wcy-fdu merged commit 001814f into main Jun 8, 2022
@wcy-fdu wcy-fdu deleted the wcy_prefix_iter branch June 8, 2022 03:09
let start_key_with_prefix = self.keyspace.prefixed_key(&key_bytes);
let cell_based_bounds = (
Included(start_key_with_prefix.clone()),
Included(next_key(start_key_with_prefix.as_slice())),
Copy link
Member

Choose a reason for hiding this comment

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

next key should be excluded?

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, indeed my fault. Thanks for your correcting and will be fixed in later PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create CellbasedTable::iter with optional pk_prefix and pk bounds(upper, lower)
3 participants