Skip to content

Commit

Permalink
1<col and col <10 seem as 1<=col and col <=10
Browse files Browse the repository at this point in the history
  • Loading branch information
junwen12221 committed May 23, 2022
1 parent 1ead1e1 commit d977897
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.time.LocalDateTime;
import java.util.*;

import static io.mycat.querycondition.ComparisonOperator.LTE;

@AllArgsConstructor
@Getter
@ToString
Expand Down Expand Up @@ -165,7 +167,7 @@ public static List<Partition> getPartitions(CustomRuleFunction customRuleFunctio
ArrayList<Object> leftValues = new ArrayList<>(2);
ArrayList<Object> rightValues = new ArrayList<>(2);

if (rangeQueryUpperOp == ComparisonOperator.LT || rangeQueryUpperOp == ComparisonOperator.LTE) {
if (rangeQueryUpperOp == ComparisonOperator.LT || rangeQueryUpperOp == LTE) {
for (Object o1 : rangeQueryLowerKey) {
if (o1 instanceof RexNode) {
o1 = MycatRexUtil.resolveParam((RexNode) o1, params);
Expand Down Expand Up @@ -194,7 +196,13 @@ public static List<Partition> getPartitions(CustomRuleFunction customRuleFunctio
}
Map<String, RangeVariable> map = new HashMap<>();
if (smallOne != null && bigOne != null) {
if (rangeQueryUpperOp == ComparisonOperator.LTE && rangeQueryLowerOp == ComparisonOperator.GTE ||
if (rangeQueryUpperOp == ComparisonOperator.LT){
rangeQueryUpperOp = LTE;
}
if (rangeQueryLowerOp == ComparisonOperator.GT){
rangeQueryLowerOp = ComparisonOperator.GTE;
}
if (rangeQueryUpperOp == LTE && rangeQueryLowerOp == ComparisonOperator.GTE ||
rangeQueryUpperOp == ComparisonOperator.LT && rangeQueryLowerOp == ComparisonOperator.GT)
for (String indexColumnName : condition.getIndexColumnNames()) {
RangeVariable rangeVariable = new RangeVariable(indexColumnName, RangeVariableType.RANGE, smallOne, bigOne);
Expand All @@ -204,7 +212,7 @@ public static List<Partition> getPartitions(CustomRuleFunction customRuleFunctio
RangeVariableType type = null;
if (rangeQueryUpperOp == ComparisonOperator.LT) {
type = RangeVariableType.LT;
} else if (rangeQueryUpperOp == ComparisonOperator.LTE) {
} else if (rangeQueryUpperOp == LTE) {
type = RangeVariableType.LTE;
}
if (type != null) {
Expand Down

0 comments on commit d977897

Please sign in to comment.