-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Feat/support for redis 8 vector sets #3221
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
base: main
Are you sure you want to change the base?
Feat/support for redis 8 vector sets #3221
Conversation
Signed-off-by: annemayor <[email protected]>
Signed-off-by: annemayor <[email protected]>
a6f4df4
to
c6f326a
Compare
@mp911de I am going to go on the next step. Pleaes, let me know if I have to switch my PR direction. |
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.
I went over the PR initially and left a few comments. The general direction looks neat, we should also have a reactive implementation and we have to make up our mind how we want to surface Vector sets from the Template API.
* @param options the options for the command | ||
* @return true if the element was added, false if it already existed | ||
*/ | ||
Boolean vAdd(byte @NonNull [] key, byte @NonNull [] values, byte @NonNull [] element, VAddOptions options); |
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.
values
should be named vector
to indicate better what this API method is about. VAddOptions
can be explicitly @Nullable
* @param options the options for the command | ||
* @return true if the element was added, false if it already existed | ||
*/ | ||
Boolean vAdd(byte @NonNull [] key, double @NonNull [] values, byte @NonNull [] element, VAddOptions options); |
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.
Please rename values
to vector
. We do have a specific Vector
type in Spring Data Commons and it would make sense to use that one as well as separate method. In fact, this vAdd
method could be turned into a default method using Vector.unsafe(double[])
and delegate to the method accepting Vector
.
this.maxConnections = builder.maxConnections; | ||
} | ||
|
||
public static Builder builder() { |
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.
We typically don't use builders (see XAddOptions
).
return target; | ||
} | ||
|
||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); |
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.
Let's not introduce a mandatory dependency on Jackson.
Assert.notNull(values, "Values must not be null"); | ||
Assert.notNull(element, "Element must not be null"); | ||
|
||
// TODO: Implement when Lettuce adds native support for V.ADD |
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.
Lettuce 6.7 has support for Vector sets.
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.
FWIW the API surface in 6.7 is still in experimental state.
There are some pending changes that need to be addressed before we can promote it.
See redis/lettuce#3459
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.
Thanks for the feedback! I’ll double-check and update the PR if needed.
private final boolean cas; | ||
private final QuantizationType quantization; | ||
private final @Nullable Integer efBuildFactor; | ||
private final @Nullable Map<String, Object> attributes; |
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.
Let's keep attributes
opaque and make it a String
without us being involved in JSON serialization for the time being.
Thank you for your comments. I am gonna address your comments. |
This PR implements a partial feature to validate the code conventions and assess the impact scope. If this approach aligns with the project's direction, I will proceed with implementing the remaining functionality.
Please review and let me know if this is the right approach.
AS-IS
no support for redis 8 vector set
TO-BE
add feature vAdd of redis 8 vector set for Jedis
partially resolved #3153
Next Step