Skip to content
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

Removing redundant type conversions for script scoring for hamming space with binary vectors #2351

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kasundra07
Copy link

Description

Removes the unnecessary type conversion from byte[] to float[] and again float[] to byte for script score on KNN Binary vector using hamming space. This would help bring down the overall query latency.

For details, check #1827 (comment)

Related Issues

Resolves #1827

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • N/A API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • N/A Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@jmazanec15
Copy link
Member

@kasundra07 I had a question around approach: #1827 (comment). Can you respond on this PR thread:

@kasundra07 Why not create a byte implementation that mirrors:

@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public abstract class KNNVectorScriptDocValues extends ScriptDocValues<float[]> {

Something like

@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public abstract class KNNByteVectorScriptDocValues extends ScriptDocValues<byte[]> {

Copy link
Contributor

@Vikasht34 Vikasht34 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wil Review this PR once this changes are completed to create the new Class for Byte.

public abstract class KNNByteVectorScriptDocValues extends ScriptDocValues<byte[]> {

…ace with binary vectors

Signed-off-by: Bansi Kasundra <[email protected]>
@kasundra07 kasundra07 force-pushed the BinaryHammingFix branch 3 times, most recently from e4b8382 to fedc541 Compare January 9, 2025 07:17
Copy link
Member

@jmazanec15 jmazanec15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Please address @VijayanB feedback

Signed-off-by: Bansi Kasundra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants