-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add check for used Cassandra partition columns #11082
Add check for used Cassandra partition columns #11082
Conversation
@@ -69,8 +71,13 @@ public CassandraPartitionResult getPartitions(CassandraTableHandle cassandraTabl | |||
remainingTupleDomain = tupleDomain; | |||
} | |||
else { | |||
List<ColumnHandle> partitionColumns = ImmutableList.copyOf(partitionKeys); | |||
remainingTupleDomain = tupleDomain.filter((column, domain) -> !partitionColumns.contains(column)); | |||
ImmutableSet<ColumnHandle> usedPartitionColumns = partitions.stream() |
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.
Declare as Set
remainingTupleDomain = tupleDomain.filter((column, domain) -> !partitionColumns.contains(column)); | ||
ImmutableSet<ColumnHandle> usedPartitionColumns = partitions.stream() | ||
.flatMap(partition -> Optional.ofNullable(partition.getTupleDomain()).stream() | ||
.flatMap(tD -> tD.getDomains().stream()) |
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.
tD -> tupleDomain/domain
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.
it clashes with the other variables, but domain is ok.
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've got another idea, take a look now please.
dba44d1
to
078b187
Compare
plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/CassandraTestingUtils.java
Outdated
Show resolved
Hide resolved
Thank to this we don't drop partition Predicates, that does not match in Cassandra, totally out of the query. This prediction droping results in returning to many rows.
078b187
to
369a251
Compare
Merged, thanks! |
Description
Thanks to this we don't drop partition Predicates, that does not
match in Cassandra, totally out of the query. As it is today results in
returning some rows when none should be returned.
Related issues, pull requests, and links
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
( ) No release notes entries required.
(x) Release notes entries required with the following suggested text: