Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Dec 18, 2024
1 parent b919b1a commit 5bd7802
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public RangeSet<MultiColumnBound> visitNullSafeEqual(NullSafeEqual nullSafeEqual
Expression right = nullSafeEqual.right();
if (left instanceof SlotReference && right instanceof Literal) {
if (slotIds.contains(((SlotReference) left).getExprId().asInt())) {
Range<ColumnBound> singleton = ColumnBound.singleton(new NullLiteral(left.getDataType()));
Range<ColumnBound> singleton = ColumnBound.singleton((Literal) right);
return toRangeSet((SlotReference) left, singleton, BoundType.CLOSED, BoundType.CLOSED);
}
}
Expand Down Expand Up @@ -187,8 +187,10 @@ public RangeSet<MultiColumnBound> visitLessThan(LessThan lessThan, Void context)
Expression right = lessThan.right();
if (left instanceof SlotReference && right instanceof Literal) {
if (slotIds.contains(((SlotReference) left).getExprId().asInt())) {
Range<ColumnBound> singleton = ColumnBound.singleton((Literal) right);
return toRangeSet((SlotReference) left, singleton, BoundType.CLOSED, BoundType.OPEN);
Range<ColumnBound> columnRange = ColumnBound.range(
new NullLiteral(right.getDataType()), BoundType.CLOSED, (Literal) right, BoundType.OPEN
);
return toRangeSet((SlotReference) left, columnRange, BoundType.CLOSED, BoundType.OPEN);
}
}
return null;
Expand All @@ -200,8 +202,10 @@ public RangeSet<MultiColumnBound> visitLessThanEqual(LessThanEqual lessThanEqual
Expression right = lessThanEqual.right();
if (left instanceof SlotReference && right instanceof Literal) {
if (slotIds.contains(((SlotReference) left).getExprId().asInt())) {
Range<ColumnBound> singleton = ColumnBound.singleton((Literal) right);
return toRangeSet((SlotReference) left, singleton, BoundType.CLOSED, BoundType.CLOSED);
Range<ColumnBound> columnRange = ColumnBound.range(
new NullLiteral(right.getDataType()), BoundType.CLOSED, (Literal) right, BoundType.CLOSED
);
return toRangeSet((SlotReference) left, columnRange, BoundType.CLOSED, BoundType.CLOSED);
}
}
return null;
Expand All @@ -213,8 +217,10 @@ public RangeSet<MultiColumnBound> visitGreaterThan(GreaterThan greaterThan, Void
Expression right = greaterThan.right();
if (left instanceof SlotReference && right instanceof Literal) {
if (slotIds.contains(((SlotReference) left).getExprId().asInt())) {
Range<ColumnBound> singleton = ColumnBound.singleton((Literal) right);
return toRangeSet((SlotReference) left, singleton, BoundType.OPEN, BoundType.CLOSED);
Range<ColumnBound> columnRange = ColumnBound.range(
(Literal) right, BoundType.OPEN, new MaxLiteral(right.getDataType()), BoundType.CLOSED
);
return toRangeSet((SlotReference) left, columnRange, BoundType.OPEN, BoundType.CLOSED);
}
}
return null;
Expand All @@ -226,8 +232,10 @@ public RangeSet<MultiColumnBound> visitGreaterThanEqual(GreaterThanEqual greater
Expression right = greaterThanEqual.right();
if (left instanceof SlotReference && right instanceof Literal) {
if (slotIds.contains(((SlotReference) left).getExprId().asInt())) {
Range<ColumnBound> singleton = ColumnBound.singleton((Literal) right);
return toRangeSet((SlotReference) left, singleton, BoundType.CLOSED, BoundType.CLOSED);
Range<ColumnBound> columnRange = ColumnBound.range(
(Literal) right, BoundType.CLOSED, new MaxLiteral(right.getDataType()), BoundType.CLOSED
);
return toRangeSet((SlotReference) left, columnRange, BoundType.CLOSED, BoundType.CLOSED);
}
}
return null;
Expand All @@ -248,7 +256,7 @@ private RangeSet<MultiColumnBound> toRangeSet(
}
}
MultiColumnBound lowerBound = new MultiColumnBound(lowerBounds);
MultiColumnBound upperBound = new MultiColumnBound(lowerBounds);
MultiColumnBound upperBound = new MultiColumnBound(upperBounds);

Range<MultiColumnBound> range = Range.range(lowerBound, lowerBoundType, upperBound, upperBoundType);
return ImmutableRangeSet.of(range);
Expand Down

0 comments on commit 5bd7802

Please sign in to comment.