@@ -108,17 +108,31 @@ private byte[] parseStartKeyToBytes(List<ObObj> key) {
108108 }
109109
110110 private boolean isKeyInRange (ObNewRange range , List <ObObj > key ) {
111- byte [] startKeyBytes = parseStartKeyToBytes (range .getStartKey ().getObjs ());
112- byte [] endKeyBytes = parseStartKeyToBytes (range .getEndKey ().getObjs ());
113- byte [] keyBytes = parseStartKeyToBytes (key );
111+ if (range .getStartKey ().getObj (0 ).isMinObj () && range .getEndKey ().getObj (0 ).isMaxObj ()) {
112+ return true ;
113+ } else if (range .getStartKey ().getObj (0 ).isMinObj ()) {
114+ byte [] keyBytes = parseStartKeyToBytes (key );
115+ byte [] endKeyBytes = parseStartKeyToBytes (range .getEndKey ().getObjs ());
116+ int endComparison = compareByteArrays (endKeyBytes , keyBytes );
117+ return endComparison > 0 ;
118+ } else if (range .getEndKey ().getObj (0 ).isMaxObj ()) {
119+ byte [] keyBytes = parseStartKeyToBytes (key );
120+ byte [] startKeyBytes = parseStartKeyToBytes (range .getStartKey ().getObjs ());
121+ int startComparison = compareByteArrays (startKeyBytes , keyBytes );
122+ return startComparison <= 0 ;
123+ } else {
124+ byte [] startKeyBytes = parseStartKeyToBytes (range .getStartKey ().getObjs ());
125+ byte [] endKeyBytes = parseStartKeyToBytes (range .getEndKey ().getObjs ());
126+ byte [] keyBytes = parseStartKeyToBytes (key );
114127
115- int startComparison = compareByteArrays (startKeyBytes , keyBytes );
116- int endComparison = compareByteArrays (endKeyBytes , keyBytes );
128+ int startComparison = compareByteArrays (startKeyBytes , keyBytes );
129+ int endComparison = compareByteArrays (endKeyBytes , keyBytes );
117130
118- boolean withinStart = startComparison <= 0 ;
119- boolean withinEnd = endComparison > 0 ;
131+ boolean withinStart = startComparison <= 0 ;
132+ boolean withinEnd = endComparison > 0 ;
120133
121- return withinStart && withinEnd ;
134+ return withinStart && withinEnd ;
135+ }
122136 }
123137
124138
0 commit comments