Skip to content

Commit

Permalink
Merge pull request #29 from RedisJSON/gkorland-duplicate
Browse files Browse the repository at this point in the history
Break after the first equals result_value to avoid duplicates
  • Loading branch information
gkorland authored Mar 14, 2022
2 parents ebfb0d1 + 9035411 commit 6da271e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/select/expr_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ where
for result_value in &ret {
if (*map_value).eq(*result_value) {
tmp.push(*rel_value);
break;
}
}
}
Expand Down
40 changes: 39 additions & 1 deletion tests/array_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,42 @@ fn bugs40_bracket_notation_after_recursive_descent() {
"more"
]),
);
}
}

#[test]
fn bugs92_duplicate_result_similar_indernal_values() {
setup();

select_and_then_compare(
"$[?(@.name.first=='A')]",
json!([
{
"name":{
"first":"A"
}
},
{
"name":{
"first":"A"
}
},
{
"name":{
"first":"B"
}
}
]),
json!([
{
"name":{
"first":"A"
}
},
{
"name":{
"first":"A"
}
}
]),
);
}

0 comments on commit 6da271e

Please sign in to comment.