Skip to content

Commit

Permalink
Fix map[string]number parse
Browse files Browse the repository at this point in the history
  • Loading branch information
twowind committed Mar 10, 2024
1 parent 6af6c7b commit 6793fa5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ var ddls = []string{
ipv6 IPv6,
fs FixedString(8),
lc LowCardinality(String),
m Map(String, Array(Int64))
m Map(String, Array(Int64)),
mi64 Map(String, Int64)
) ENGINE = Memory`,
`INSERT INTO data VALUES
(-1, 1, 1.0, true, '1', '1', [1], [10], '2011-03-06', '2011-03-06 06:20:00', 'one', '10.1111', '100.1111', '1000.1111', '1.1111', '127.0.0.1', '2001:db8:3333:4444:5555:6666:7777:8888', '12345678', 'one', {'key1':[1]}),
(-2, 2, 2.0, false, '2', '2', [2], [20], '2012-05-31', '2012-05-31 11:20:00', 'two', '30.1111', '300.1111', '2000.1111', '2.1111', '8.8.8.8', '2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF', '88888888', 'two', {'key2':[2]}),
(-3, 3, 3.0, true, '3', '2', [3], [30], '2016-04-04', '2016-04-04 11:30:00', 'three', '40.1111', '400.1111', '3000.1111', '3.1111', '255.255.255.255', '::1234:5678', '87654321', 'three', {'key3':[3]})
(-1, 1, 1.0, true, '1', '1', [1], [10], '2011-03-06', '2011-03-06 06:20:00', 'one', '10.1111', '100.1111', '1000.1111', '1.1111', '127.0.0.1', '2001:db8:3333:4444:5555:6666:7777:8888', '12345678', 'one', {'key1':[1]}, {'key1':1}),
(-2, 2, 2.0, false, '2', '2', [2], [20], '2012-05-31', '2012-05-31 11:20:00', 'two', '30.1111', '300.1111', '2000.1111', '2.1111', '8.8.8.8', '2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF', '88888888', 'two', {'key2':[2]}, {'key2':2}),
(-3, 3, 3.0, true, '3', '2', [3], [30], '2016-04-04', '2016-04-04 11:30:00', 'three', '40.1111', '400.1111', '3000.1111', '3.1111', '255.255.255.255', '::1234:5678', '87654321', 'three', {'key3':[3]}, {'key3':3})
`,
}

Expand Down
2 changes: 1 addition & 1 deletion conn_go18_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *connSuite) TestColumnTypes() {
"Int64", "UInt64", "Float64", "Bool", "String", "String", "Array(Int16)", "Array(UInt8)", "Date", "DateTime",
"Enum8('one' = 1, 'two' = 2, 'three' = 3)",
"Decimal(9, 4)", "Decimal(18, 4)", "Decimal(38, 4)", "Decimal(10, 4)", "IPv4", "IPv6", "FixedString(8)", "LowCardinality(String)",
"Map(String, Array(Int64))",
"Map(String, Array(Int64))", "Map(String, Int64)",
}
s.Require().Equal(len(expected), len(types))
for i, e := range expected {
Expand Down
1 change: 1 addition & 0 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (s *connSuite) TestQuery() {
"10.1111", "100.1111", "1000.1111", "1.1111", "127.0.0.1",
"2001:db8:3333:4444:5555:6666:7777:8888", "12345678", "one",
map[string][]int64{"key1": {1}},
map[string]int64{"key1": 1},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion dataparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ loop:
switch r {
case eof:
break loop
case ',', ']', ')':
case ',', ']', ')', '}':
_ = s.UnreadRune()
break loop
}
Expand Down

0 comments on commit 6793fa5

Please sign in to comment.