Skip to content

DATAREDIS-293 - allow bulk add members with the same score #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2923,10 +2923,6 @@ private Map<byte[], Double> zAddArgs(Set<Tuple> tuples) {

Map<byte[], Double> args = new HashMap<byte[], Double>();
for (Tuple tuple : tuples) {
if (args.containsValue(tuple.getScore())) {
throw new UnsupportedOperationException(
"Bulk add of multiple elements with the same score is not supported. Add the elements individually.");
}
args.put(tuple.getValue(), tuple.getScore());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ public void testClosePool() {
factory2.destroy();
}

@Test(expected = UnsupportedOperationException.class)
@Test
public void testZAddSameScores() {
Set<StringTuple> strTuples = new HashSet<StringTuple>();
strTuples.add(new DefaultStringTuple("Bob".getBytes(), "Bob", 2.0));
strTuples.add(new DefaultStringTuple("James".getBytes(), "James", 2.0));
connection.zAdd("myset", strTuples);
Long added = connection.zAdd("myset", strTuples);
assertEquals(2L, added.longValue());
}

@Test(expected = InvalidDataAccessApiUsageException.class)
Expand Down