Conversation
jgaleotti
requested changes
Feb 24, 2026
| private Map<String, RedisValueData> createRedisInfoForIntersection(List<String> commandKeys, ReflectionBasedRedisClient redisClient) { | ||
| Set<String> keySet = redisClient.getKeysByType(REDIS_SET_TYPE); | ||
|
|
||
| Map<String, RedisValueData> redisData = new HashMap<>(); |
Collaborator
There was a problem hiding this comment.
add a comment explaining what the what is the key and what is the value.
| private Map<String, RedisValueData> createRedisInfoForAllKeys(ReflectionBasedRedisClient redisClient) { | ||
| Set<String> keys = redisClient.getAllKeys(); | ||
| List<RedisInfo> redisData = new ArrayList<>(); | ||
| Map<String, RedisValueData> redisData = new HashMap<>(); |
| Set<String> keys = redisClient.getKeysByType(type); | ||
| List<RedisInfo> redisData = new ArrayList<>(); | ||
| keys.forEach(key -> redisData.add(new RedisInfo(key))); | ||
| Map<String, RedisValueData> redisData = new HashMap<>(); |
| Set<String> keys = redisClient.getKeysByType(REDIS_HASH_TYPE); | ||
| List<RedisInfo> redisData = new ArrayList<>(); | ||
| keys.forEach(key -> redisData.add(new RedisInfo(key, redisClient.getHashFields(key)))); | ||
| Map<String, RedisValueData> redisData = new HashMap<>(); |
| private String key; | ||
| private String type; | ||
| public class RedisValueData { | ||
| private Map<String, String> fields; |
Collaborator
There was a problem hiding this comment.
add a comment explaining what the what is the key and what is the value.
|
|
||
| if (i == 0) { | ||
| currentIntersection = new HashSet<>(set); | ||
| double d0 = currentIntersection.isEmpty() ? MAX_REDIS_DISTANCE : 0d; |
Collaborator
There was a problem hiding this comment.
d0 and 0d are misleading variable names and values
| @@ -256,12 +290,11 @@ private RedisDistanceWithMetrics calculateDistanceForIntersection( | |||
| : 0d; | |||
|
|
|||
| total += di; | |||
Collaborator
There was a problem hiding this comment.
use a more declarative variable name than "di"
| String field = redisCommand.extractArgs().get(1); | ||
| List<RedisInfo> redisInfo = createRedisInfoForKeysByField(field, redisClient); | ||
| return calculator.computeDistance(redisCommand, redisInfo); | ||
| Map<String, RedisValueData> redisValueData = createRedisInfoForKeysByField(redisClient); |
Collaborator
There was a problem hiding this comment.
Shouldn't this mapping be encapsulated into a representation of the data stored in the Redis Database?
| String targetKey, | ||
| String targetField, | ||
| List<RedisInfo> keys | ||
| Map<String, RedisValueData> keys |
Collaborator
There was a problem hiding this comment.
this does not seem to be Redis keys only
| int evaluated = 0; | ||
|
|
||
| for (RedisInfo k : keys) { | ||
| for (String key : keys.keySet()) { |
Collaborator
There was a problem hiding this comment.
this is weird, the keyset of the keys?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Redis e2e tests now cover HASH, PATTERN and SET commands.
RedisData class has been refactored so that a key-value map is used in heuristic calculations.
Set intersection heuristic calculation has been refactored and now includes a distance calculation for each key to the set keys stored in Redis.