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
Describe the bug, including details regarding any error messages, version, and platform.
When marshaling array.Int64 or array.Uint64 to JSON the original int64 or unit64 values can be lost.
The cause is that the values are casted to float64 before marshaling, and that type is not big enough to hold all possible int64 or unit64 values.
A possible solution is to only do the casting to float64 when the array is of unit8 like the comment says, or skip the casting for int64 and unit64 arrays
Component(s)
Go
The text was updated successfully, but these errors were encountered:
…rshaling arrays (#35950)
### Rationale for this change
See [issue](#35948).
Based on https://github.com/apache/arrow/blob/9fb8697dcb442f63317c7d6046393fb74842e0ae/go/arrow/array/numeric.gen.go.tmpl#L120 it seems we should only do the casting for `unit8` and `int8` types.
### What changes are included in this PR?
This PR fixes the numeric template so it only casts `int8` and `unit8` to `float64` when JSON marshaling arrays to avoid losing data for other types.
### Are these changes tested?
Yes
### Are there any user-facing changes?
The user facing change is that if a user was JSON marshaling arrays that has `uint64` or `int64` values they can now get different (more accurate) values than before
* Closes: #35948
Authored-by: erezrokah <erezrokah@users.noreply.github.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
…SON marshaling arrays (apache#35950)
### Rationale for this change
See [issue](apache#35948).
Based on https://github.com/apache/arrow/blob/9fb8697dcb442f63317c7d6046393fb74842e0ae/go/arrow/array/numeric.gen.go.tmpl#L120 it seems we should only do the casting for `unit8` and `int8` types.
### What changes are included in this PR?
This PR fixes the numeric template so it only casts `int8` and `unit8` to `float64` when JSON marshaling arrays to avoid losing data for other types.
### Are these changes tested?
Yes
### Are there any user-facing changes?
The user facing change is that if a user was JSON marshaling arrays that has `uint64` or `int64` values they can now get different (more accurate) values than before
* Closes: apache#35948
Authored-by: erezrokah <erezrokah@users.noreply.github.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
(cherry picked from commit 745fa94)
Describe the bug, including details regarding any error messages, version, and platform.
When marshaling
array.Int64
orarray.Uint64
to JSON the originalint64
orunit64
values can be lost.The cause is that the values are casted to
float64
before marshaling, and that type is not big enough to hold all possibleint64
orunit64
values.Relevant code:
arrow/go/arrow/array/numeric.gen.go
Line 104 in 4ec231b
arrow/go/arrow/array/numeric.gen.go
Line 199 in 4ec231b
Adding the following tests to
numeric_test.go
result in failures:A possible solution is to only do the casting to
float64
when the array is ofunit8
like the comment says, or skip the casting forint64
andunit64
arraysComponent(s)
Go
The text was updated successfully, but these errors were encountered: