waynr commented on code in PR #40889:
URL: https://github.com/apache/arrow/pull/40889#discussion_r1546587603
##########
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:
Ah, thanks for catching that! I was wondering how to determine what the
multiplier should be since the `array.Duration` didn't seem to me to have any
obvious way to determine it. After taking a closer look at the embedded `array`
struct in `array.Duration` I kind of see how it works now. I fixed this and
added more unit test cases for different `TimeUnit` values.
--
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]