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 ScanBuilder bug #1045

Merged
merged 2 commits into from
Sep 4, 2023
Merged

Fix ScanBuilder bug #1045

merged 2 commits into from
Sep 4, 2023

Conversation

brfrn169
Copy link
Collaborator

I encountered a bug where ScanBuilder doesn't create a proper ScanAll instance when we call projection()/projections()/ordering()/orderings()/limit()/consistency() before calling where(). I'll add inline comments for the details. Please take a look!

@brfrn169 brfrn169 self-assigned this Aug 30, 2023
Comment on lines +547 to +550
this.limit = buildable.limit;
this.projections.addAll(buildable.projections);
this.orderings.addAll(buildable.orderings);
this.consistency = buildable.consistency;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should also pass these parameters here.

Comment on lines +607 to +610
.projections(Arrays.asList("pk1", "ck1"))
.projection("ck2")
.projections("ck3", "ck4")
.where(ConditionBuilder.column("ck1").isGreaterThanInt(10))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call projection() and projections() before calling where() here, and we lost the values with the bug.

Comment on lines +628 to +629
.limit(10)
.where(ConditionBuilder.column("ck1").isGreaterThanInt(10))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call limit() before calling where() here, and we lost the value with the bug.

Comment on lines +649 to +652
.ordering(ordering1)
.orderings(Arrays.asList(ordering2, ordering3))
.orderings(ordering4, ordering5)
.where(ConditionBuilder.column("ck1").isGreaterThanInt(10))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call ordering()/orderings() before calling where() here, and we lost the values with the bug.

Comment on lines +670 to +671
.consistency(Consistency.EVENTUAL)
.where(ConditionBuilder.column("ck1").isGreaterThanInt(10))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call consistency() before calling where() here, and we lost the value with the bug.

Copy link
Contributor

@jnmt jnmt left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the fix. It's my mad. I should have added more tests and noticed it when fixing a similar bug before.

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@brfrn169 brfrn169 merged commit 703d3b8 into master Sep 4, 2023
13 checks passed
@brfrn169 brfrn169 deleted the fix-scan-builder-bug branch September 4, 2023 04:15
feeblefakie pushed a commit that referenced this pull request Sep 4, 2023
brfrn169 added a commit that referenced this pull request Oct 26, 2023
brfrn169 added a commit that referenced this pull request Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants