-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-15760: Fix AbstractReadQuery.toCQLString #2083
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
Conversation
Checklist before you submit for review
|
ee2c990 to
eba724d
Compare
|
@adelapena can you look and fix this warning? It's an unused import to my understanding. |
76a1e87 to
0a941fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two comments with questions after the latest change, which I like as it simplifies the code, and after my review on #2038. They might lead to changes or just replies. Re-request my review when they were addressed or replied.
| // Remove index restrictions for this clustering column from the row filter, so we don't print them twice. | ||
| // The row filter can contain expressions copying the clustering filter restrictions, because indexed | ||
| // clustering key restrictions are added to the row filter at the CQL layer for easier consumption | ||
| // downstream. However, due to CQL validation the row filter won't contain additional expressions for | ||
| // columns that are included in the clustering filter, besided the aformentioned copies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to assert or test this assumption that the additional conditions on the column are not present in the row filter for a clustering column? Does it make sense to test/assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption in toCQLString methods is that the commands come from well-formed and validated CQL commands, I don't think we want the extra overload of validating/asserting on every consumer. Even more when in this case it's tricky that the IN restrictions of the clustering key are duplicated into the row filter as a serialized value, and we don't probably want to deserialize for an assertion. Can you think of any specific query that might not satisfy the behaviour described in the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should be more clear about what I mean about the assumption. The assumption is that rowFilter contains only the duplicated conditions on clustering columns and, thus, removing all conditions on the clustering column is fine. If it will be changed in future that other conditions on the clustering column will be included by the validator, then how to make sure to update printing those conditions in this code? Is there a way to implement a test, which will have an extra condition on clustering column, which is currently not included into rowFilter?
Or do I misunderstand your comment about rowFilter content in the case of clustering column?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added included some defensive checks in testToCQLString about the CQL semantics regarding clustering columns, so if CQL somehow gets to change that way we detect that toCQLString methods might need to change too. Not really sure we should really do this kind of defensive downstream checks, but glad to have them if it help us moving forward.
src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
Outdated
Show resolved
Hide resolved
|
@k-rus I think I have addressed the two new comments in the second round of review of this PR. |
Fixes for toCQLString mainly coming from CASSANDRA-16510, and removal of code duplication.
ab95101 to
3b4bf04
Compare
|
✔️ Build ds-cassandra-pr-gate/PR-2083 approved by ButlerApproved by Butler |
Fix AbstractReadQuery.toCQLString to produce output that is as close to valid CQL as possible. The fixes here mainly come from CASSANDRA-16510, and there is also some removal of code duplication.
Fix AbstractReadQuery.toCQLString to produce output that is as close to valid CQL as possible. The fixes here mainly come from CASSANDRA-16510, and there is also some removal of code duplication.
Fix AbstractReadQuery.toCQLString to produce output that is as close to valid CQL as possible. The fixes here mainly come from CASSANDRA-16510, and there is also some removal of code duplication.
Fix AbstractReadQuery.toCQLString to produce output that is as close to valid CQL as possible. The fixes here mainly come from CASSANDRA-16510, and there is also some removal of code duplication.



What is the issue
Testing of CNDB-15280 has revealed that the output of
AbstractReadQuery.toCQLStringis frequently invalid CQL.What does this PR fix and why was it fixed
This PR fixes AbstractReadQuery.toCQLString` to produce output that is as close to valid CQL as possible.
The output cannot always be entirely valid CQL because:
This is closely related to CNDB-15280, which testing exposes most of the issues fixed here, so both issues should be blocked on each other.