Skip to content

Commit

Permalink
give up null partitions
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Dec 3, 2024
1 parent 6f50381 commit c891f89
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,15 @@ private OptExpression optimizeWithPartitionPrune(OptExpression optExpression,
if (hasMinMax.first) {
List<Long> sorted = partitionInfo.getSortedPartitions(true);
sorted.retainAll(nonEmptyPartitionIds);
sorted.removeAll(nullPartitions);
if (CollectionUtils.isEmpty(sorted)) {
return null;
}
// TODO: in theory if we can confirm one partition contains only NULL values, we can rule out these
// partitions from sorted. But currently a range-partition can contains both NULL value and regular
// values
if (nullPartitions.contains(sorted.get(0))) {
return null;
}
pruned.add(sorted.get(0));
}

Expand All @@ -240,6 +245,9 @@ private OptExpression optimizeWithPartitionPrune(OptExpression optExpression,
if (CollectionUtils.isEmpty(sorted)) {
return null;
}
if (nullPartitions.contains(sorted.get(0))) {
return null;
}
pruned.add(sorted.get(0));
}

Expand Down

0 comments on commit c891f89

Please sign in to comment.