Skip to content

Commit

Permalink
Apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Oct 31, 2024
1 parent ae2d2e4 commit f9e22c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ func unmarshalVector(info VectorType, data []byte, value interface{}) error {
}
if k == reflect.Array {
if rv.Len() != info.Dimensions {
return unmarshalErrorf("unmarshal vector: array with wrong size")
return unmarshalErrorf("unmarshal vector: array of size %d cannot store vector of %d dimensions", rv.Len(), info.Dimensions)
}
} else {
rv.Set(reflect.MakeSlice(t, info.Dimensions, info.Dimensions))
Expand Down
4 changes: 1 addition & 3 deletions vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ func TestVector_Types(t *testing.T) {
actual := a.([]net.IP)
assertEqual(t, "vector size", len(expected), len(actual))
for i, _ := range expected {
// TODO(lantoniak): Find a better way to compare IP addresses
assertEqual(t, "vector", expected[i].String(), actual[i].String())
assertTrue(t, "vector", expected[i].Equal(actual[i]))
}
},
},
Expand All @@ -163,7 +162,6 @@ func TestVector_Types(t *testing.T) {
{name: "smallint", cqlType: TypeSmallInt.String(), value: []int16{127, 256, -1234}},
{name: "tinyint", cqlType: TypeTinyInt.String(), value: []int8{127, 9, -123}},
{name: "duration", cqlType: TypeDuration.String(), value: []Duration{duration1, duration2, duration3}},
// TODO(lantonia): Test vector of custom types
{name: "vector_vector_float", cqlType: "vector<float, 5>", value: [][]float32{{0.1, -1.2, 3, 5, 5}, {10.1, -122222.0002, 35.0, 1, 1}, {0, 0, 0, 0, 0}}},
{name: "vector_vector_set_float", cqlType: "vector<set<float>, 5>", value: [][][]float32{
{{1, 2}, {2, -1}, {3}, {0}, {-1.3}},
Expand Down

0 comments on commit f9e22c7

Please sign in to comment.