-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
4 changed files
with
100 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package issues | ||
|
||
import ( | ||
"context" | ||
"github.com/ClickHouse/clickhouse-go/v2" | ||
clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test1067(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() | ||
` | ||
require.NoError(t, conn.Exec(ctx, ddl)) | ||
defer func() { | ||
conn.Exec(ctx, "DROP TABLE IF EXISTS test_1066") | ||
}() | ||
|
||
batch, err := conn.PrepareBatch(context.Background(), "INSERT INTO test_1066") | ||
require.NoError(t, err) | ||
require.NoError(t, batch.Append("1970-01-02")) | ||
require.NoError(t, batch.Append(time.Now())) | ||
require.NoError(t, batch.Send()) | ||
} |