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 duplicate of equal fields in the query when do range scanning with multiple clustering keys in Cassandra adapter #328

Merged
merged 6 commits into from
Oct 7, 2021

Conversation

thongdk8
Copy link
Contributor

@thongdk8 thongdk8 commented Oct 1, 2021

When do integration testing with multiple clustering keys, I found that with the current implementation, it conducts duplicate of the equal fields in the query when doing range scanning with provided start and end clustering keys so got failed from Cassandra. For example, the wrong query is
SELECT * FROM integration_testing_FLOAT.test_table_mul_key_FLOAT_BIGINT WHERE c1=? AND c2=? AND c3>=? AND c2=? AND c3<=? ORDER BY c2 ASC,c3 ASC;
should be corrected to
SELECT * FROM integration_testing_FLOAT.test_table_mul_key_FLOAT_BIGINT WHERE c1=? AND c2=? AND c3>=? AND c3<=? ORDER BY c2 ASC,c3 ASC;
(remove one AND c2=?)
This PR was made for fixing it.
Please take a look. Thank you.

@thongdk8 thongdk8 added the bugfix label Oct 1, 2021
@thongdk8 thongdk8 self-assigned this Oct 1, 2021
@thongdk8 thongdk8 marked this pull request as ready for review October 1, 2021 08:04
Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

Overall LGTM! I just left minor comment and suggestion. Thank you!

@thongdk8 thongdk8 requested a review from brfrn169 October 7, 2021 03:01
brfrn169
brfrn169 previously approved these changes Oct 7, 2021
Copy link
Collaborator

@brfrn169 brfrn169 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!

feeblefakie
feeblefakie previously approved these changes Oct 7, 2021
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!

I left one minor suggestion about the naming.
Also, I noticed some redundancy that we can improve in setStart/setEnd and bindStart/bindEnd.
It would be nice if you can make it less redundant in another PR if possible.

@@ -157,13 +161,15 @@ private void setStart(Select.Where statement, Scan scan) {
statement.and(gt(start.get(i).getName(), bindMarker()));
}
} else {
statement.and(eq(start.get(i).getName(), bindMarker()));
String cKeyName = start.get(i).getName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
String cKeyName = start.get(i).getName();
String clusteringKeyName = start.get(i).getName();

Yeah, it's a bit long... but I think it's more clear. (otherwise we need to think what c stands for).
Please update the other parts.

Copy link
Contributor Author

@thongdk8 thongdk8 Oct 7, 2021

Choose a reason for hiding this comment

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

Thanks. Applied in commit

@thongdk8 thongdk8 dismissed stale reviews from feeblefakie and brfrn169 via ce330af October 7, 2021 05:25
@brfrn169 brfrn169 merged commit e05b51d into master Oct 7, 2021
@brfrn169 brfrn169 deleted the fix-cassandra-scan-query-with-mul-ckey branch October 7, 2021 09:03
brfrn169 pushed a commit that referenced this pull request Oct 31, 2021
…h multiple clustering keys in Cassandra adapter (#328)
brfrn169 pushed a commit that referenced this pull request Oct 31, 2021
…h multiple clustering keys in Cassandra adapter (#328)
brfrn169 pushed a commit that referenced this pull request Nov 1, 2021
…h multiple clustering keys in Cassandra adapter (#328)
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.

3 participants