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

fix: 32bit build fails #390

Merged
merged 2 commits into from
Apr 30, 2024
Merged

fix: 32bit build fails #390

merged 2 commits into from
Apr 30, 2024

Conversation

zeroshade
Copy link
Contributor

The Apache Arrow project uses this library for supporting reading Avro into Apache Arrow record batches. A dependabot alert to update to a new version fails building in the CI due to usage of int(1 << 48) which fails on the cross-build CI for 32-bit systems link.

If we explicitly type it as an int64 this alleviates the problem and allows this library to continue to successfully build on 32-bit systems.

config.go Outdated
if size > maxAllocSize || size <= 0 {
return maxAllocSize
if int64(size) > maxAllocSize || size <= 0 {
return int(maxAllocSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this not overflow on a 32bit system? Perhaps the entire function needs to return an int64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if I change that to be an int64 we end up with an issue in codec_array.go because sliceType.UnsafeGrow accepts an int and not an int64. Which means we'd just be pushing the overflow to that spot instead.

Maybe we need to change the maxAllocSize to a different value for 32-bit systems?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable. I am a little surprised the actual value is not different between these systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this with my most recent commit. Let me know what you think

Copy link
Member

@nrwiersma nrwiersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏🏻 Thanks for the contribution

@nrwiersma nrwiersma merged commit 5dde47b into hamba:main Apr 30, 2024
3 checks passed
@zeroshade zeroshade deleted the fix-32bit-build branch April 30, 2024 17:07
@zeroshade
Copy link
Contributor Author

Thanks @nrwiersma! Please let me know when this will go out with a new version release so I can update the dependency in the Apache Arrow repo :)

@nrwiersma
Copy link
Member

@zeroshade I just bumped the version to v2.21.1.

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

Successfully merging this pull request may close these issues.

2 participants