Skip to content
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

marshalBigInt return 8 bytes slice in all cases except for big.Int, which returns a variable length slice #1740

Open
fesiqueira opened this issue Mar 1, 2024 · 0 comments

Comments

@fesiqueira
Copy link

fesiqueira commented Mar 1, 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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant