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

[BugFix] fix list partition multi values' probelm (backport #51036) #52677

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public Map<Long, List<String>> getIdToValues() {
* @param id
* @return true if the partition can be pruned
*/
public boolean pruneById(long id) {
public boolean isSingleValuePartition(long id) {
List<String> values = getIdToValues().get(id);
if (values != null && values.size() == 1) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ private Set<Long> evalBinaryPredicate(BinaryPredicateOperator binaryPredicate) {
} else {
Set<Long> partitionIds = partitionValueMap.get(literal);
for (Long id : partitionIds) {
if (listPartitionInfo.pruneById(id)) {
if (listPartitionInfo.isSingleValuePartition(id)) {
matches.remove(id);
}
}
Expand Down Expand Up @@ -706,7 +706,18 @@ private Set<Long> evalInPredicate(InPredicateOperator inPredicate) {
Set<Long> partitions = partitionValueMap.get(literal);
if (partitions != null) {
if (inPredicate.isNotIn()) {
matches.removeAll(partitions);
// external table, one partition column for one partition can only have one value
if (listPartitionInfo == null) {
matches.removeAll(partitions);
} else {
// for olap table, if one partition is multi value partition like PARTITION pCalifornia VALUES IN ("Los Angeles","San Francisco","San Diego")
// and we have a not in predicate like city not in ("Los Angeles"), it's not safe to remove this partition
for (Long id : partitions) {
if (listPartitionInfo.isSingleValuePartition(id)) {
matches.remove(id);
}
}
}
} else {
matches.addAll(partitions);
}
Expand Down
Loading