GH-35948: [Go] Only cast int8 and unit8 to float64 when JSON marshaling arrays - #35950
Conversation
int8 and unit8 to float64 when JSON marshaling arraysint8 and unit8 to float64 when JSON marshaling arrays
|
Not sure if the failing test is related to flaky, help appreciated |
|
@erezrokah The failing test is indeed a flaky test, I haven't yet been able to reproduce it locally in order to fix it which annoys me. But you're fine. |
zeroshade
left a comment
There was a problem hiding this comment.
LGTM! Thanks much for this!
|
Thanks for the quick review and merge! |
|
Benchmark runs are scheduled for baseline = 105b9df and contender = 745fa94. 745fa94 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
…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)
Rationale for this change
See issue.
Based on
arrow/go/arrow/array/numeric.gen.go.tmpl
Line 120 in 9fb8697
unit8andint8types.What changes are included in this PR?
This PR fixes the numeric template so it only casts
int8andunit8tofloat64when 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
uint64orint64values they can now get different (more accurate) values than beforeint64orunit64arrays to JSON can cause loss of data #35948