zeroshade commented on code in PR #1109:
URL: https://github.com/apache/arrow-go/pull/1109#discussion_r3896322886
##########
arrow/scalar/temporal.go:
##########
@@ -40,7 +46,20 @@ func temporalToString(s TemporalScalar) string {
case *Time64:
return time.Unix(0,
int64(s.Value)*int64(s.Unit().Multiplier())).UTC().Format("15:04:05.999999999")
case *Timestamp:
- return time.Unix(0,
int64(s.Value)*int64(s.Unit().Multiplier())).UTC().Format("2006-01-02
15:04:05.999999999")
+ typ := s.DataType().(*arrow.TimestampType)
+ toTime, err := typ.GetToTimeFunc()
+ if err != nil {
+ return "..."
+ }
+ tm := toTime(s.Value)
+ layout := timestampScalarLayout
+ if typ.TimeZone != "" {
+ layout = timestampScalarZoneLayout
+ if _, offset := tm.Zone(); offset%60 != 0 {
+ layout = timestampScalarZoneSecondsLayout
+ }
+ }
+ return tm.Format(layout)
Review Comment:
Wide second, millisecond, and microsecond timestamp values still do not
round-trip through `String()` and `ParseScalar`. For example, `timestamp[s,
tz=UTC]` at `math.MaxInt64` renders as `292277026596-12-04 15:30:07Z`, which
the parser rejects as excess fractional precision; `math.MinInt64` is also
formatted incorrectly. Please support expanded/signed years in parsing or use
an exact fallback representation outside the textual date range, and add
min/max round-trip tests for every unit and timezone category.
--
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]