You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Cassandra error message: Expected 8 or 0 byte long (7).
What happens is that when Marshaling to bigint, for all other types the marshalBigInt internal function will return a slice with length 8, but for big.Int it returns a variable length slice, which can sometimes be 7, 14, ..., depending of the underlying value of the big.Int.
I'd like to know if it's known and if it's a bug. Per math/big documentation, to get a fixed length slice the big.Int.FillBytes should be used instead.
The text was updated successfully, but these errors were encountered:
Hello, Felipe!
This issue is caused by different bigint types of implementations in Cassandra and in the driver. Cassandra has a limitation in eight-byte for bigint, however, in gocql it's implemented as an arbitrary-precision type.
It's already fixed, thank you for issuing it.
Have a great day!
joao-r-reis
changed the title
marshalBigInt return 8 bytes slice in all cases except for big.Int, which returns a variable length slice
CASSGO-2 marshalBigInt return 8 bytes slice in all cases except for big.Int, which returns a variable length slice
Oct 30, 2024
What version of Cassandra are you using?
3.11.11
What version of Gocql are you using?
v1.6.0
What version of Go are you using?
1.21.6
What did you do?
Marshaled a big.Int variable. A example can be found here: https://go.dev/play/p/xShpJBbX2f2
What did you expect to see?
I expected the query to work
What did you see instead?
A Cassandra error message:
Expected 8 or 0 byte long (7)
.What happens is that when
Marshal
ing tobigint
, for all other types themarshalBigInt
internal function will return a slice with length 8, but forbig.Int
it returns a variable length slice, which can sometimes be 7, 14, ..., depending of the underlying value of thebig.Int
.I'd like to know if it's known and if it's a bug. Per
math/big
documentation, to get a fixed length slice thebig.Int.FillBytes
should be used instead.The text was updated successfully, but these errors were encountered: