-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
invalid reading value for Date32 #1066
Labels
Comments
Hi @Alucardinio I've reproduced this issue with following code: package issues
import (
"context"
"github.com/ClickHouse/clickhouse-go/v2"
clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"time"
)
func Test1066(t *testing.T) {
var (
conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{
"max_execution_time": 60,
}, nil, &clickhouse.Compression{
Method: clickhouse.CompressionLZ4,
})
)
ctx := context.Background()
require.NoError(t, err)
const ddl = `
CREATE TABLE test_1066 (
Col1 Date32
) Engine MergeTree() ORDER BY tuple()
`
defer func() {
conn.Exec(ctx, "DROP TABLE IF EXISTS test_1066")
}()
require.NoError(t, conn.Exec(ctx, ddl))
expectedDate := time.Date(2010, 10, 10, 0, 0, 0, 0, time.UTC)
require.NoError(t, conn.Exec(ctx, `INSERT INTO test_1066 (Col1) VALUES(?)`, expectedDate))
row := conn.QueryRow(ctx, "SELECT Col1 FROM test_1066")
require.NoError(t, err)
var actualDate time.Time
require.NoError(t, row.Scan(&actualDate))
assert.Equal(t, expectedDate, actualDate)
} It seems there is an issue in Date32 native format decoding. Will continue investigating. |
The root cause is wrong Date32 implementation in ch-go: ClickHouse/ch-go#319 |
This will be fixed by ClickHouse/ch-go#320 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Describe the bug
When reading a value from the Date32 column, the value shifts back 45 years, or jumps into the future
Steps to reproduce
Expected behaviour
For 2010-10-10 returns 2010-10-10
Code example
Configuration
Environment
ClickHouse server
CREATE TABLE
statements for tables involved:CREATE TABLE new
(
timestamp
Date32,event_id
UInt8)
ENGINE = MergeTree
ORDER BY event_id
The text was updated successfully, but these errors were encountered: