mirror of https://github.com/tidwall/tile38.git
Fix a bug in WHEREIN -- 0 values would always match, incorrectly.
This commit is contained in:
parent
914f51de11
commit
25579a052c
|
@ -359,7 +359,7 @@ func (s *Server) parseSearchScanBaseTokens(
|
||||||
err = errInvalidArgument(valStr)
|
err = errInvalidArgument(valStr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
valArr = append(valArr, val)
|
valArr[i] = val
|
||||||
}
|
}
|
||||||
t.whereins = append(t.whereins, whereinT{field, -1, valArr})
|
t.whereins = append(t.whereins, whereinT{field, -1, valArr})
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -394,6 +394,9 @@ func keys_WHEREIN_test(mc *mockServer) error {
|
||||||
{"SET", "mykey", "myid_a2", "FIELD", "a", 2, "POINT", 32.99, -115}, {"OK"},
|
{"SET", "mykey", "myid_a2", "FIELD", "a", 2, "POINT", 32.99, -115}, {"OK"},
|
||||||
{"SET", "mykey", "myid_a3", "FIELD", "a", 3, "POINT", 33, -115.02}, {"OK"},
|
{"SET", "mykey", "myid_a3", "FIELD", "a", 3, "POINT", 33, -115.02}, {"OK"},
|
||||||
{"WITHIN", "mykey", "WHEREIN", "a", 3, 0, 1, 2, "BOUNDS", 32.8, -115.2, 33.2, -114.8}, {`[0 [[myid_a1 {"type":"Point","coordinates":[-115,33]} [a 1]] [myid_a2 {"type":"Point","coordinates":[-115,32.99]} [a 2]]]]`},
|
{"WITHIN", "mykey", "WHEREIN", "a", 3, 0, 1, 2, "BOUNDS", 32.8, -115.2, 33.2, -114.8}, {`[0 [[myid_a1 {"type":"Point","coordinates":[-115,33]} [a 1]] [myid_a2 {"type":"Point","coordinates":[-115,32.99]} [a 2]]]]`},
|
||||||
|
// zero value should not match 1 and 2
|
||||||
|
{"SET", "mykey", "myid_a0", "FIELD", "a", 0, "POINT", 33, -115.02}, {"OK"},
|
||||||
|
{"WITHIN", "mykey", "WHEREIN", "a", 2, 1, 2, "BOUNDS", 32.8, -115.2, 33.2, -114.8}, {`[0 [[myid_a1 {"type":"Point","coordinates":[-115,33]} [a 1]] [myid_a2 {"type":"Point","coordinates":[-115,32.99]} [a 2]]]]`},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue