-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when i get more than "2262-04-12 07:47:16" on datetime64,get wrong value by time.Time #1311
Comments
Hello @joneechua Please provide all details |
i read the clickhouse result by the go code above,get the unexpected result
but i read this record from clickhouse client
|
how can i get the correct string result by go driver? thx. |
@joneechua please have a look into a "Details" section of issue content. Please provide a driver version and other missing values. Thank you. |
sorry about that, I've revised this section. |
The max value for any DateTime64 precision is hardcoded as (UTC timezone): https://github.com/ClickHouse/clickhouse-go/blob/v2.26.0/lib/column/datetime64.go#L37 maxDateTime64, _ = time.Parse("2006-01-02 15:04:05", "2262-04-11 23:47:16") However, this should be the case only for
Currently, if you specify a |
I can confirm there is a int64 overflow happening in this line: we need to do a better math here. |
Observed
CREATE TABLE t2 (
idUInt8,
dtDateTime64(8, 'Asia/Shanghai') ) ENGINE = MergeTree ORDER BY id SETTINGS index_granularity = 8192
insert into t2 values(1,'2262-04-12 07:47:18'),(2,'2262-04-12 07:47:16.854750000')
rows.Scan(var interface{}...) b, _ := val.(time.Time) log.Println(b.Format("2006-01-02 15:04:05.00000000"), b.Unix())
Expected behaviour
get Expected Result
1, 2262-04-12 07:47:18.00000000 2, 2262-04-12 07:47:16.85475000
Code example
Error log
get the Unexpected results, and it appears that an overflow value is returned by time.Time.Unix()
Details
Environment
clickhouse-go
version: v2.24.0database/sql
compatible driverCREATE TABLE
statements for tables involved: See No. 1 aboveThe text was updated successfully, but these errors were encountered: