-
Notifications
You must be signed in to change notification settings - Fork 245
feat: add special handling of vector sub-type COMPASS-8257 #6834
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
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.
Pull Request Overview
This PR adds special handling for BSON Binary values with the vector sub-type, specifically addressing different vector types (Int8, Float32, and PackedBit) by formatting their serialized representations.
- Introduces a new branch for values with the Binary.SUBTYPE_VECTOR
- Implements separate formatting logic for Int8, Float32, and PackedBit vectors
Comments suppressed due to low confidence (1)
packages/compass-components/src/components/bson-value.tsx:190
- The vector handling block does not explicitly handle unexpected vector types. Consider adding an 'else' clause to safely manage vector types that are not Int8, Float32, or PackedBit.
}
| const vectorType = value.buffer[0]; | ||
| if (vectorType === Binary.VECTOR_TYPE.Int8) { | ||
| const truncatedSerializedBuffer = truncate( | ||
| value.toInt8Array().slice(0, 100).toString(), |
Copilot
AI
Apr 2, 2025
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.
[nitpick] Relying on the default toString() conversion for arrays may lead to inconsistent formatting. Consider using a method like join(', ') for clearer and more predictable output.
| value.toInt8Array().slice(0, 100).toString(), | |
| value.toInt8Array().slice(0, 100).join(', '), |
5139d5e to
6c66e57
Compare
|
Going to take over to get this finalized. |
Description
As is
Suggested to be
Checklist
Motivation and Context
Open Questions
The table view for this is not awesome, but we would have to revisit either the principle of showing copy-pastable code in the cells or the driver API to improve that.
Dependents
Types of changes