Skip to content

Commit 46ebaa6

Browse files
Make LowerBound nullable
1 parent 845b4a9 commit 46ebaa6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteIndexManager.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ public Set<DocumentKey> getDocumentsMatchingTarget(Target target) {
208208
@Nullable FieldIndex fieldIndex = getMatchingIndex(target);
209209
if (fieldIndex == null) return null;
210210

211+
// Can this be an empty list?
211212
@Nullable List<Value> arrayValues = target.getArrayValues(fieldIndex);
213+
// Can this be non-nullable again?
212214
@Nullable Bound lowerBound = target.getLowerBound(fieldIndex);
213215
@Nullable Bound upperBound = target.getUpperBound(fieldIndex);
214216

@@ -224,9 +226,9 @@ public Set<DocumentKey> getDocumentsMatchingTarget(Target target) {
224226
}
225227

226228
Object[] lowerBoundValues = encodeDirectionalBound(fieldIndex, target, lowerBound);
227-
String lowerBoundOp = lowerBound != null ? (lowerBound.isInclusive() ? ">=" : ">") : null;
229+
String lowerBoundOp = lowerBound != null && lowerBound.isInclusive() ? ">=" : ">";
228230
Object[] upperBoundValues = encodeDirectionalBound(fieldIndex, target, upperBound);
229-
String upperBoundOp = upperBound != null ? (upperBound.isInclusive() ? "<=" : "<") : null;
231+
String upperBoundOp = upperBound != null && upperBound.isInclusive() ? "<=" : "<";
230232

231233
SQLitePersistence.Query query =
232234
generateQuery(
@@ -252,9 +254,9 @@ private SQLitePersistence.Query generateQuery(
252254
int indexId,
253255
@Nullable List<Value> arrayValues,
254256
@Nullable Object[] lowerBounds,
255-
@Nullable String lowerBoundOp,
257+
String lowerBoundOp,
256258
@Nullable Object[] upperBounds,
257-
@Nullable String upperBoundOp) {
259+
String upperBoundOp) {
258260
StringBuilder statement = new StringBuilder();
259261
statement.append(
260262
"SELECT document_name, directional_value FROM index_entries WHERE index_id = ? ");

0 commit comments

Comments
 (0)