Filter might return duplicate results when the internal objects are similar.
e.g. input JSON both objects have name == {"first":"A","middle":"A"}
[{{"name":{"first":"A","middle":"A"},"rank":8},{"name":{"first":"A","middle":"A"},"rank":90}]
When running:
The following result is returned:
[{{"name":{"first":"A","middle":"A"},"rank":8},{"name":{"first":"A","middle":"A"},"rank":8},{{"name":{"first":"A","middle":"A"},"rank":90},{"name":{"first":"A","middle":"A"},"rank":90}]
It seems like the bug is in this code which compares all the candidates with all values and return each "parent" twice.
|
for result_value in &ret { |
ref RedisJSON/RedisJSON#667
Filter might return duplicate results when the internal objects are similar.
e.g. input JSON both objects have name ==
{"first":"A","middle":"A"}[{{"name":{"first":"A","middle":"A"},"rank":8},{"name":{"first":"A","middle":"A"},"rank":90}]When running:
The following result is returned:
[{{"name":{"first":"A","middle":"A"},"rank":8},{"name":{"first":"A","middle":"A"},"rank":8},{{"name":{"first":"A","middle":"A"},"rank":90},{"name":{"first":"A","middle":"A"},"rank":90}]It seems like the bug is in this code which compares all the candidates with all values and return each "parent" twice.
jsonpath/src/select/expr_term.rs
Line 107 in 1a84c5a
ref RedisJSON/RedisJSON#667