@@ -157,6 +157,37 @@ const BinaryValue: React.FunctionComponent<PropsByValueType<'Binary'>> = ({
157157
158158 return { stringifiedValue : `UUID('${ uuid } ')` } ;
159159 }
160+ if ( value . sub_type === Binary . SUBTYPE_VECTOR ) {
161+ const vectorType = value . buffer [ 0 ] ;
162+ if ( vectorType === Binary . VECTOR_TYPE . Int8 ) {
163+ const truncatedSerializedBuffer = truncate (
164+ value . toInt8Array ( ) . slice ( 0 , 100 ) . join ( ', ' ) ,
165+ 100
166+ ) ;
167+ return {
168+ stringifiedValue : `Binary.fromInt8Array(new Int8Array([${ truncatedSerializedBuffer } ]))` ,
169+ } ;
170+ } else if ( vectorType === Binary . VECTOR_TYPE . Float32 ) {
171+ const truncatedSerializedBuffer = truncate (
172+ [ ...value . toFloat32Array ( ) . slice ( 0 , 100 ) ]
173+ // Using a limited precision and removing trailing zeros for better displaying
174+ . map ( ( num ) => num . toPrecision ( 8 ) . replace ( / \. ? 0 + $ / , '' ) )
175+ . join ( ', ' ) ,
176+ 100
177+ ) ;
178+ return {
179+ stringifiedValue : `Binary.fromFloat32Array(new Float32Array([${ truncatedSerializedBuffer } ]))` ,
180+ } ;
181+ } else if ( vectorType === Binary . VECTOR_TYPE . PackedBit ) {
182+ const truncatedSerializedBuffer = truncate (
183+ value . toPackedBits ( ) . slice ( 0 , 100 ) . join ( ', ' ) ,
184+ 100
185+ ) ;
186+ return {
187+ stringifiedValue : `Binary.fromPackedBits(new Uint8Array([${ truncatedSerializedBuffer } ]))` ,
188+ } ;
189+ }
190+ }
160191 return {
161192 stringifiedValue : `Binary.createFromBase64('${ truncate (
162193 value . toString ( 'base64' ) ,
0 commit comments