-
Notifications
You must be signed in to change notification settings - Fork 110
RUBY-3521 Add binary vector support #344
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
RUBY-3521 Add binary vector support #344
Conversation
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.
Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.
Files not reviewed (4)
- spec/spec_tests/data/binary_vector/float32.json: Language not supported
- spec/spec_tests/data/binary_vector/int8.json: Language not supported
- spec/spec_tests/data/binary_vector/packed_bit.json: Language not supported
- spec/spec_tests/data/corpus/binary.json: Language not supported
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.
Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.
Files not reviewed (4)
- spec/spec_tests/data/binary_vector/float32.json: Language not supported
- spec/spec_tests/data/binary_vector/int8.json: Language not supported
- spec/spec_tests/data/binary_vector/packed_bit.json: Language not supported
- spec/spec_tests/data/corpus/binary.json: Language not supported
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.
Copilot reviewed 12 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (4)
- spec/spec_tests/data/binary_vector/float32.json: Language not supported
- spec/spec_tests/data/binary_vector/int8.json: Language not supported
- spec/spec_tests/data/binary_vector/packed_bit.json: Language not supported
- spec/spec_tests/data/corpus/binary.json: Language not supported
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.
Copilot reviewed 12 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (4)
- spec/spec_tests/data/binary_vector/float32.json: Language not supported
- spec/spec_tests/data/binary_vector/int8.json: Language not supported
- spec/spec_tests/data/binary_vector/packed_bit.json: Language not supported
- spec/spec_tests/data/corpus/binary.json: Language not supported
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.
Copilot reviewed 12 out of 16 changed files in this pull request and generated no comments.
Files not reviewed (4)
- spec/spec_tests/data/binary_vector/float32.json: Language not supported
- spec/spec_tests/data/binary_vector/int8.json: Language not supported
- spec/spec_tests/data/binary_vector/packed_bit.json: Language not supported
- spec/spec_tests/data/corpus/binary.json: Language not supported
Comments suppressed due to low confidence (1)
lib/bson/binary.rb:169
- Consider enhancing this error message by listing the supported vector types to aid debugging when an unsupported type is encountered.
raise ArgumentError, "Unsupported vector type: #{dtype_value}" unless dtype
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.
LGTM! 👍
lib/bson/binary.rb
Outdated
| elsif padding.negative? || padding > 7 | ||
| raise ArgumentError, "Padding must be between 1 and 7, got #{padding}" |
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.
Is padding == 0 allowed? The error message suggests not, but the condition permits it.
This PR introduces support for the new BSON::Binary subtype - binary vector
Our API differs from the spec and introduces
validate_vector_dataargument for thefrom_vectormethod. Contrary to many other languages,Array.packdoes not raise an error when supplied data does not match to the provided format. Therefore, we have to validate the input by ourselves, and this slows down the encoding significantly. So, we provide user a toggle to enable it when they need it.