lidavidm commented on code in PR #39674:
URL: https://github.com/apache/arrow/pull/39674#discussion_r1457465807
##########
go/arrow/datatype_fixedwidth.go:
##########
@@ -88,11 +84,7 @@ func (d Date32) FormattedString() string {
// Date64FromTime returns a Date64 value from a time object
func Date64FromTime(t time.Time) Date64 {
- if _, offset := t.Zone(); offset != 0 {
- // properly account for timezone adjustments before we calculate
- // the actual value by adjusting the time and converting to UTC
- t = t.Add(time.Duration(offset) * time.Second).UTC()
- }
+ t = t.In(time.UTC)
Review Comment:
Time.Unix() claims it is independent of the location, is this strictly
needed?
##########
go/arrow/datatype_fixedwidth.go:
##########
@@ -88,11 +84,7 @@ func (d Date32) FormattedString() string {
// Date64FromTime returns a Date64 value from a time object
func Date64FromTime(t time.Time) Date64 {
- if _, offset := t.Zone(); offset != 0 {
- // properly account for timezone adjustments before we calculate
- // the actual value by adjusting the time and converting to UTC
- t = t.Add(time.Duration(offset) * time.Second).UTC()
- }
+ t = t.In(time.UTC)
Review Comment:
Since in theory if this change were needed, the adjustment above and the
adjustment here would be the same?
##########
go/arrow/compute/internal/kernels/cast_temporal.go:
##########
@@ -125,6 +129,10 @@ func TimestampToDate64(ctx *exec.KernelCtx, batch
*exec.ExecSpan, out *exec.Exec
return ScalarUnaryNotNull(func(_ *exec.KernelCtx, arg0 arrow.Timestamp,
_ *error) arrow.Date64 {
tm := fnToTime(arg0)
+ if _, offset := tm.Zone(); offset != 0 {
+ // normalize the tm
+ tm = tm.Add(time.Duration(offset) * time.Second).UTC()
+ }
Review Comment:
~this is effectively taking a timestamp with timezone and turning it into a
naive timestamp showing the date in the former timezone (but marked as UTC)?
--
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]