Skip to content

Commit

Permalink
[fix](nereids)fix rangeSet intersect in PartitionPredicateToRange (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei authored Jan 3, 2025
1 parent 6589a2e commit 7b45bc3
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ public RangeSet<MultiColumnBound> visitAnd(And and, Void context) {
intersects = childRanges;
continue;
}

for (Range<MultiColumnBound> childRange : childRanges.asRanges()) {
intersects = intersects.subRangeSet(childRange);
if (intersects.isEmpty()) {
break;
}
}
intersects = intersection(childRanges, intersects);
if (intersects.isEmpty()) {
break;
}
Expand Down Expand Up @@ -264,4 +258,12 @@ private RangeSet<MultiColumnBound> toRangeSet(SlotReference slotReference,
Range<MultiColumnBound> range = Range.range(lowerBound, lowerBoundType, upperBound, upperBoundType);
return ImmutableRangeSet.of(range);
}

public static <T extends Comparable<?>> RangeSet<T> intersection(RangeSet<T> rangeSet1, RangeSet<T> rangeSet2) {
RangeSet<T> result = TreeRangeSet.create();
for (Range<T> range : rangeSet1.asRanges()) {
result.addAll(rangeSet2.subRangeSet(range));
}
return result;
}
}
Loading

0 comments on commit 7b45bc3

Please sign in to comment.