RUBY-3521 Add binary vector support#344
Conversation
There was a problem hiding this comment.
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.
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.
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.
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.
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
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.
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.