zeroshade commented on code in PR #40889:
URL: https://github.com/apache/arrow/pull/40889#discussion_r1546429531
##########
go/arrow/flight/flightsql/driver/utils.go:
##########
@@ -104,6 +104,13 @@ func fromArrowType(arr arrow.Array, idx int) (interface{},
error) {
return v.ToTime(ts.TimeUnit()), nil
case *array.Date64:
return c.Value(idx).ToTime(), nil
+ case *array.Duration:
+ // according to
+ //
https://github.com/apache/arrow/blob/50ca7a76d38e6ecf19589bc44f46bffd1db0d4c8/format/Schema.fbs#L420-L435
+ // the default "TimeUnit" for an arrow.Duration is in microseconds but
+ // golang Durations are int64 nanoseconds
+ duration := time.Duration(int64(c.Value(idx) * 1000))
Review Comment:
this should probably be `time.Duration(int64(c.Value(idx))) *
arr.DataType().(*arrow.Duration).TimeUnit.Multiplier()` in order to produce
nanoseconds. Or something to that end. Like the other types, you need to use
the `TimeUnit` to determine what unit the values are in for durations, you
can't just blindly multiply by 1000.
--
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]