Skip to content

Commit 6ac161a

Browse files
committed
Update Errorf format string.
1 parent 4899c60 commit 6ac161a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

enginetest/queries/vector_ddl_queries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ var VectorDDLQueries = []ScriptTest{
111111
{
112112
// Value exceeds float32 max
113113
Query: `INSERT INTO error_vectors VALUES (6, STRING_TO_VECTOR('[1e40]'))`,
114-
ExpectedErrStr: "data cannot be converted to a valid vector: 1e40",
114+
ExpectedErrStr: "data cannot be converted to a valid vector: 1e+40",
115115
},
116116
{
117117
Query: `CREATE TABLE error_vectors (id INT PRIMARY KEY, vec3 VECTOR(-3))`,

sql/core.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func DecodeVector(buf []byte) ([]float32, error) {
337337
if len(buf)%int(values.Float32Size) != 0 {
338338
return nil, ErrVectorInvalidBinaryLength.New(len(buf))
339339
}
340-
return unsafe.Slice((*float32)(unsafe.Pointer(&buf[0])), len(buf)/int(values.Float32Size)), true
340+
return unsafe.Slice((*float32)(unsafe.Pointer(&buf[0])), len(buf)/int(values.Float32Size)), nil
341341
}
342342

343343
// EncodeVector encodes a byte slice that represents a vector.
@@ -386,7 +386,7 @@ func convertJsonInterfaceToVector(val interface{}) ([]float32, error) {
386386
res[i] = v
387387
case float64:
388388
if v > math.MaxFloat32 || v < -math.MaxFloat32 {
389-
return nil, fmt.Errorf("data cannot be converted to a valid vector: %d", v)
389+
return nil, fmt.Errorf("data cannot be converted to a valid vector: %v", v)
390390
}
391391
res[i] = float32(v)
392392
case int64:

0 commit comments

Comments
 (0)