You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/10/08 16:21:22 UTC
[GitHub] [arrow] zeroshade commented on a change in pull request #11310: ARROW-13804: [Go] Add Interval type Month, Day, Nano
zeroshade commented on a change in pull request #11310:
URL: https://github.com/apache/arrow/pull/11310#discussion_r725146540
##########
File path: go/arrow/internal/arrjson/arrjson.go
##########
@@ -1670,6 +1689,35 @@ func daytimeintervalToJSON(arr *array.DayTimeInterval) []interface{} {
return o
}
+func monthDayNanointervalFromJSON(vs []interface{}) []arrow.MonthDayNanoInterval {
+ o := make([]arrow.MonthDayNanoInterval, len(vs))
+ for i, vv := range vs {
+ v := vv.(map[string]interface{})
+ months, err := v["months"].(json.Number).Int64()
+ if err != nil {
+ panic(err)
+ }
+ days, err := v["days"].(json.Number).Int64()
+ if err != nil {
+ panic(err)
+ }
+ ns, err := v["nanoseconds"].(json.Number).Int64()
+ if err != nil {
+ panic(err)
+ }
+ o[i] = arrow.MonthDayNanoInterval{Months: int32(months), Days: int32(days), Nanoseconds: ns}
Review comment:
I believe that `int32` will just truncate if the value of months or days is larger than an int32 can hold.
The other areas in the integration testing pieces here didn't check for overflows i don't think so i didn't think it was necessary to do so, but I can add checks to error on over/underflow if that's needed. Thoughts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org