diff --git a/examples/std/map.go b/examples/std/map.go index c8b41c325f..42f2115c86 100644 --- a/examples/std/map.go +++ b/examples/std/map.go @@ -19,6 +19,7 @@ package std import ( "fmt" + "github.com/ClickHouse/clickhouse-go/v2" ) @@ -33,7 +34,7 @@ func MapInsertRead() error { , Col2 Map(String, UInt64) , Col3 Map(String, UInt64) , Col4 Array(Map(String, String)) - , Col5 Map(LowCardinality(String), LowCardinality(UInt64)) + , Col5 Map(LowCardinality(String), LowCardinality(String)) ) Engine Memory ` conn.Exec("DROP TABLE example") @@ -65,9 +66,9 @@ func MapInsertRead() error { {"A": "B"}, {"C": "D"}, } - col5Data = map[string]uint64{ - "key_col_5_1": 100, - "key_col_5_2": 200, + col5Data = map[string]string{ + "key_col_5_1": "100", + "key_col_5_2": "200", } ) if _, err := batch.Exec(col1Data, col2Data, col3Data, col4Data, col5Data); err != nil { @@ -81,7 +82,7 @@ func MapInsertRead() error { col2 map[string]uint64 col3 map[string]uint64 col4 []map[string]string - col5 map[string]uint64 + col5 map[string]string ) if err := conn.QueryRow("SELECT * FROM example").Scan(&col1, &col2, &col3, &col4, &col5); err != nil { return err diff --git a/tests/issues/692_test.go b/tests/issues/692_test.go index e20966a441..445ce01c43 100644 --- a/tests/issues/692_test.go +++ b/tests/issues/692_test.go @@ -48,7 +48,7 @@ func TestIssue692(t *testing.T) { , Col2 Map(String, UInt64) , Col3 Map(String, UInt64) , Col4 Array(Map(String, String)) - , Col5 Map(LowCardinality(String), LowCardinality(UInt64)) + , Col5 Map(LowCardinality(String), LowCardinality(String)) , Col6 Map(String, Map(String, Int64)) ) Engine MergeTree() ORDER BY tuple() ` @@ -77,9 +77,9 @@ func TestIssue692(t *testing.T) { {"A": "B"}, {"C": "D"}, } - col5Data = map[string]uint64{ - "key_col_5_1": 100, - "key_col_5_2": 200, + col5Data = map[string]string{ + "key_col_5_1": "100", + "key_col_5_2": "200", } col6Data = map[string]map[string]int64{} ) @@ -91,7 +91,7 @@ func TestIssue692(t *testing.T) { col2 map[string]uint64 col3 map[string]uint64 col4 []map[string]string - col5 map[string]uint64 + col5 map[string]string col6 map[string]map[string]int64 ) require.NoError(t, conn.QueryRow("SELECT Col1, Col2, Col3, Col4, Col5, Col6 FROM test_map").Scan(&col1, &col2, &col3, &col4, &col5, &col6)) diff --git a/tests/map_test.go b/tests/map_test.go index b5c373d36f..7c1febb24f 100644 --- a/tests/map_test.go +++ b/tests/map_test.go @@ -48,7 +48,7 @@ func TestMap(t *testing.T) { , Col2 Map(String, UInt64) , Col3 Map(String, UInt64) , Col4 Array(Map(String, String)) - , Col5 Map(LowCardinality(String), LowCardinality(UInt64)) + , Col5 Map(LowCardinality(String), LowCardinality(String)) , Col6 Map(String, Map(String,UInt64)) ) Engine MergeTree() ORDER BY tuple() ` @@ -72,9 +72,9 @@ func TestMap(t *testing.T) { map[string]string{"A": "B"}, map[string]string{"C": "D"}, } - col5Data = map[string]uint64{ - "key_col_5_1": 100, - "key_col_5_2": 200, + col5Data = map[string]string{ + "key_col_5_1": "100", + "key_col_5_2": "200", } col6Data = map[string]map[string]uint64{ "key_col_6_1": { @@ -95,7 +95,7 @@ func TestMap(t *testing.T) { col2 map[string]uint64 col3 map[string]uint64 col4 []map[string]string - col5 map[string]uint64 + col5 map[string]string col6 map[string]map[string]uint64 ) require.NoError(t, conn.QueryRow(ctx, "SELECT * FROM test_map").Scan(&col1, &col2, &col3, &col4, &col5, &col6)) diff --git a/tests/std/map_test.go b/tests/std/map_test.go index 26a4b12e43..56a2dbda0e 100644 --- a/tests/std/map_test.go +++ b/tests/std/map_test.go @@ -50,7 +50,7 @@ func TestStdMap(t *testing.T) { , Col2 Map(String, UInt64) , Col3 Map(String, UInt64) , Col4 Array(Map(String, String)) - , Col5 Map(LowCardinality(String), LowCardinality(UInt64)) + , Col5 Map(LowCardinality(String), LowCardinality(String)) ) Engine MergeTree() ORDER BY tuple() ` defer func() { @@ -76,9 +76,9 @@ func TestStdMap(t *testing.T) { map[string]string{"A": "B"}, map[string]string{"C": "D"}, } - col5Data = map[string]uint64{ - "key_col_5_1": 100, - "key_col_5_2": 200, + col5Data = map[string]string{ + "key_col_5_1": "100", + "key_col_5_2": "200", } ) _, err = batch.Exec(col1Data, col2Data, col3Data, col4Data, col5Data) @@ -89,7 +89,7 @@ func TestStdMap(t *testing.T) { col2 map[string]uint64 col3 map[string]uint64 col4 []map[string]string - col5 map[string]uint64 + col5 map[string]string ) require.NoError(t, conn.QueryRow("SELECT * FROM test_map").Scan(&col1, &col2, &col3, &col4, &col5)) assert.Equal(t, col1Data, col1)