-
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.
Fix support custom serialization in Nested type (#1381)
- Loading branch information
Showing
4 changed files
with
66 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package issues | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/ClickHouse/clickhouse-go/v2" | ||
clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test1297(t *testing.T) { | ||
testEnv, err := clickhouse_tests.GetTestEnvironment("issues") | ||
require.NoError(t, err) | ||
conn, err := clickhouse_tests.TestClientWithDefaultOptions(testEnv, clickhouse.Settings{ | ||
"flatten_nested": "0", | ||
}) | ||
require.NoError(t, err) | ||
|
||
require.NoError(t, conn.Exec(context.Background(), `CREATE TABLE test_1297 | ||
( | ||
Id UInt8, | ||
Device LowCardinality(String), | ||
Nestme Nested( | ||
Id UInt32, | ||
TestLC LowCardinality(String), | ||
Test String | ||
) | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY Id;`), "Create table failed") | ||
t.Cleanup(func() { | ||
conn.Exec(context.Background(), "DROP TABLE IF EXISTS test_1297") | ||
}) | ||
|
||
batch, err := conn.PrepareBatch(context.Background(), "INSERT INTO test_1297") | ||
require.NoError(t, err, "PrepareBatch failed") | ||
|
||
require.NoError(t, batch.Append(uint8(1), "pc", []any{[]any{1, "test LC 1", "test"}, []any{2, "test LC 2", "test"}}), "Append failed") | ||
require.NoError(t, batch.Send()) | ||
} |
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