You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "davidhcoe (via GitHub)" <gi...@apache.org> on 2025/05/12 14:36:23 UTC
[I] (go/adbc/driver/snowflake): Large date values are not being returned correctly [arrow-adbc]
davidhcoe opened a new issue, #2811:
URL: https://github.com/apache/arrow-adbc/issues/2811
### What happened?
If you run the query for
```
select TO_TIMESTAMP('9999-12-31 00:00:00') As December31, TO_TIMESTAMP('9999-12-30 00:00:00') As December30"
```
You get incorrect values because the epoch from Snowflake () gets converted to -4852202631933722624, which is actually March 29, 1816 at 05:56:08.066278. I believe this is because during the call to:
```
v, err := arrow.TimestampFromTime(time.Unix(epoch[i], int64(fraction[i])), dt.TimeUnit())
```
The correct epoch value gets passed in, but with the TimeUnit of Nanoseconds, the internals of TimestampFromTime convert the large epoch value to nanoseconds again, causing the int64 value to overflow to the negative number:
```
func TimestampFromTime(val time.Time, unit TimeUnit) (Timestamp, error) {
switch unit {
case Second:
return Timestamp(val.Unix()), nil
case Millisecond:
return Timestamp(val.Unix()*1e3 + int64(val.Nanosecond())/1e6), nil
case Microsecond:
return Timestamp(val.Unix()*1e6 + int64(val.Nanosecond())/1e3), nil
case Nanosecond:
**return Timestamp(val.UnixNano()), nil** // <-- problematic line
default:
return 0, fmt.Errorf("%w: unexpected timestamp unit: %s", ErrInvalid, unit)
}
}
```
However, the Time value already comes in at the correct date. I am working on a proposed fix.
### Stack Trace
_No response_
### How can we reproduce the bug?
_No response_
### Environment/Setup
_No response_
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] (go/adbc/driver/snowflake): Large date values are not being returned correctly [arrow-adbc]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on issue #2811:
URL: https://github.com/apache/arrow-adbc/issues/2811#issuecomment-2891176381
Yea, i think it should be an issue with Snowflake. Though given that you can manipulate it via using `CAST` I'd be surprised if they said it was anything other than "by design"
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] (go/adbc/driver/snowflake): Large date values are not being returned correctly [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #2811: (go/adbc/driver/snowflake): Large date values are not being returned correctly
URL: https://github.com/apache/arrow-adbc/issues/2811
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] (go/adbc/driver/snowflake): Large date values are not being returned correctly [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #2811:
URL: https://github.com/apache/arrow-adbc/issues/2811#issuecomment-2954338131
Closed by https://github.com/apache/arrow-adbc/pull/2917
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] (go/adbc/driver/snowflake): Large date values are not being returned correctly [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on issue #2811:
URL: https://github.com/apache/arrow-adbc/issues/2811#issuecomment-2876497225
Judging by https://github.com/snowflakedb/gosnowflake/blob/02d592aff379ee8592eeb42047fb5117a8dc6cba/arrow_test.go#L421, it could come back as either seconds or nanoseconds but the ADBC driver only assigns nanoseconds. I'm not sure whether that is a metadata problem coming from Snowflake (https://github.com/apache/arrow-adbc/blob/2d1a4598b7ff5648028774a230f34877a3ca5a76/go/adbc/driver/snowflake/record_reader.go#L163) or something else.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org