-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: encodeTuple int32 panic #11339
fix: encodeTuple int32 panic #11339
Conversation
Result of foundationdb-pr-clang-ide on Linux CentOS 7
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr on Linux CentOS 7
|
Result of foundationdb-pr-cluster-tests on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux CentOS 7
|
CI failed, is there anything I need to add? @jzhou77 @johscheuer PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I somehow missed the review request.
First thanks for taking the time to raise this PR!
Based on my understanding it's expected that you will see an error when trying to encode an int32
as int32
is not supported by the Tuple Layer: https://github.com/apple/foundationdb/blob/main/bindings/go/src/fdb/tuple/tuple.go#L57-L59 and looking at other tuple implementations, e.g. the Java one: https://github.com/apple/foundationdb/blob/main/bindings/java/src/main/com/apple/foundationdb/tuple/Tuple.java, they only support long
and BigInteger
, which would translate to int64
and BitInt
in go
It should be safe to convert an int32
to an int64
but the Tuple layer doesn't support this officially, so it would be better to handle that in your application code. Otherwise we should add int32
and uint32
to all other Tuple implementations too.
OK, thanks for the explanation. I will close this PR. |
When using int32 type in tuple and Pack, error will occur:
panic: unencodable element at index 0 (1, type int32)
The following example can be reproduced:
This is because encodeTuple does not handle int32.
In the Go language, int and int32 are not the same type.
Fixed by adding support for int32.
Code-Reviewer Section
The general pull request guidelines can be found here.
Please check each of the following things and check all boxes before accepting a PR.
For Release-Branches
If this PR is made against a release-branch, please also check the following:
release-branch
ormain
if this is the youngest branch)