-
Notifications
You must be signed in to change notification settings - Fork 93
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
Added support for sunion and sinter #147
Open
balajivenki
wants to merge
10
commits into
Netflix:master
Choose a base branch
from
balajivenki:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
36ecc8c
Added support for sunion and sinter
balajivenki 0490711
Merge branch 'master' into master
balajivenki 90e9806
Merge remote-tracking branch 'Netflix/master'
balajivenki 018d76c
Merge branch 'master' of https://github.com/balajivenki/dyno
balajivenki e8ac130
Merge branch 'master' into master
ipapapa 09652dc
Merge branch 'master' into master
balajivenki 157319f
Merge branch 'master' into master
balajivenki 9ec4d40
Merge remote-tracking branch 'Netflix/master'
balajivenki f857bdc
Merge remote-tracking branch 'origin/master'
balajivenki 5333e19
Merge branch 'master' into master
ipapapa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
******************************************************************************/ | ||
package com.netflix.dyno.jedis; | ||
|
||
import com.google.common.collect.Sets; | ||
import com.netflix.discovery.DiscoveryClient; | ||
import com.netflix.dyno.connectionpool.*; | ||
import com.netflix.dyno.connectionpool.exception.DynoConnectException; | ||
|
@@ -25,12 +26,13 @@ | |
import com.netflix.dyno.connectionpool.impl.lb.HttpEndpointBasedTokenMapSupplier; | ||
import com.netflix.dyno.connectionpool.impl.utils.CollectionUtils; | ||
import com.netflix.dyno.connectionpool.impl.utils.ZipUtils; | ||
import com.netflix.dyno.contrib.*; | ||
|
||
import com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration; | ||
import com.netflix.dyno.contrib.DynoCPMonitor; | ||
import com.netflix.dyno.contrib.DynoOPMonitor; | ||
import com.netflix.dyno.contrib.EurekaHostsSupplier; | ||
import org.slf4j.Logger; | ||
|
||
import redis.clients.jedis.BinaryClient.LIST_POSITION; | ||
import redis.clients.jedis.*; | ||
import redis.clients.jedis.BinaryClient.LIST_POSITION; | ||
import redis.clients.jedis.params.geo.GeoRadiusParam; | ||
import redis.clients.jedis.params.sortedset.ZAddParams; | ||
import redis.clients.jedis.params.sortedset.ZIncrByParams; | ||
|
@@ -2429,7 +2431,13 @@ public Long msetnx(String... keysvalues) { | |
|
||
@Override | ||
public Set<String> sinter(String... keys) { | ||
throw new UnsupportedOperationException("not yet implemented"); | ||
Set<String> allResults = d_smembers(keys[0]).getResult(); | ||
//loop through keys and intersect to a set, use d_smembers | ||
for(int i = 1; i < keys.length; i++) { | ||
allResults = Sets.intersection(allResults, d_smembers(keys[i]).getResult()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Guava set intersection. |
||
} | ||
|
||
return allResults; | ||
} | ||
|
||
public Long sinterstore(final String dstkey, final String... keys) { | ||
|
@@ -2448,7 +2456,14 @@ public Long sort(String key, String dstkey) { | |
|
||
@Override | ||
public Set<String> sunion(String... keys) { | ||
throw new UnsupportedOperationException("not yet implemented"); | ||
Set<String> allResults = new HashSet<String>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just get all the smembers and push it to a single set. |
||
//loop through keys and append to a set, use d_smembers | ||
for(String key : keys) { | ||
OperationResult<Set<String>> results = d_smembers(key); | ||
allResults.addAll(results.getResult()); | ||
} | ||
|
||
return allResults; | ||
} | ||
|
||
@Override | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assign the global set with the first keys smembers.