Skip to content

Commit

Permalink
Fix a TZ bug when validate ErrTooHighTimestampPrecision (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yifeng-Sigma authored Feb 20, 2024
1 parent c205278 commit ca47a46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ func arrowToRecord(ctx context.Context, record arrow.Record, pool memory.Allocat
ar = arrow.Timestamp(ts.UnixNano())
// in case of overflow in arrow timestamp return error
// this could only happen for nanosecond case
if ts.Year() != ar.ToTime(arrow.Nanosecond).Year() {
if ts.UTC().Year() != ar.ToTime(arrow.Nanosecond).Year() {
return nil, &SnowflakeError{
Number: ErrTooHighTimestampPrecision,
SQLState: SQLStateInvalidDataTimeFormat,
Expand Down
2 changes: 1 addition & 1 deletion converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ func TestArrowToRecord(t *testing.T) {
defer pool.AssertSize(t, 0) // ensure no arrow memory leaks
var valids []bool // AppendValues() with an empty valid array adds every value by default

localTime := time.Date(2019, 2, 6, 14, 17, 31, 123456789, time.FixedZone("-08:00", -8*3600))
localTime := time.Date(2019, 1, 1, 1, 17, 31, 123456789, time.FixedZone("-08:00", -8*3600))
localTimeFarIntoFuture := time.Date(9000, 2, 6, 14, 17, 31, 123456789, time.FixedZone("-08:00", -8*3600))

epochField := arrow.Field{Name: "epoch", Type: &arrow.Int64Type{}}
Expand Down

0 comments on commit ca47a46

Please sign in to comment.