zeroshade commented on a change in pull request #11359:
URL: https://github.com/apache/arrow/pull/11359#discussion_r741383928
##########
File path: go/arrow/array/interval.go
##########
@@ -279,6 +341,28 @@ func (a *DayTimeInterval) setData(data *Data) {
}
}
+func (a *DayTimeInterval) getOneForMarshal(i int) interface{} {
+ if a.IsValid(i) {
+ return a.values[i]
+ }
+ return nil
+}
+
+func (a *DayTimeInterval) MarshalJSON() ([]byte, error) {
+ if a.NullN() == 0 {
+ return json.Marshal(a.values)
Review comment:
Currently DayTime interval would get marshaled as `{ "days": #,
"milliseconds": # }`, the same would be true for month day nano interval type
being marshalled as `{ "months": #, "days": #, "nanoseconds": # }`. The only
one that currently wouldn't get marshalled into a formatted object or string is
the month interval. The intention I had was that the actual types should be
defined externally before attempting to parse the JSON as I didn't build any
arrow type inference into the JSON reader. It requires being passed a schema or
data type.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]