Skip to content

Commit e71cb51

Browse files
authored
Merge branch 'master' into send-params-in-multipart-form
2 parents d8cb624 + a184a19 commit e71cb51

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
88
"ecto": {:hex, :ecto, "3.13.2", "7d0c0863f3fc8d71d17fc3ad3b9424beae13f02712ad84191a826c7169484f01", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "669d9291370513ff56e7b7e7081b7af3283d02e046cf3d403053c557894a0b3e"},
99
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
10-
"ex_doc": {:hex, :ex_doc, "0.38.3", "ddafe36b8e9fe101c093620879f6604f6254861a95133022101c08e75e6c759a", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "ecaa785456a67f63b4e7d7f200e8832fa108279e7eb73fd9928e7e66215a01f9"},
10+
"ex_doc": {:hex, :ex_doc, "0.38.4", "ab48dff7a8af84226bf23baddcdda329f467255d924380a0cf0cee97bb9a9ede", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "f7b62346408a83911c2580154e35613eb314e0278aeea72ed7fedef9c1f165b2"},
1111
"hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"},
1212
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
1313
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},

test/ch/connection_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ defmodule Ch.ConnectionTest do
597597
test "json as string", %{conn: conn} do
598598
# after v25 ClickHouse started rendering numbers in JSON as strings
599599
[[version]] = Ch.query!(conn, "select version()").rows
600-
numbers_as_strings? = version >= "25"
600+
numbers_as_strings? = version >= "25" and version <= "25.8"
601601

602602
[expected1, expected2] =
603603
if numbers_as_strings? do
@@ -608,7 +608,7 @@ defmodule Ch.ConnectionTest do
608608
else
609609
[
610610
[[~s|{"answer":42}|]],
611-
[[~s|{"a":"42"}|], [~s|{"b":"10"}|]]
611+
[[~s|{"a":42}|], [~s|{"b":10}|]]
612612
]
613613
end
614614

test/ch/json_test.exs

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ defmodule Ch.JSONTest do
1919

2020
assert select.(~s|{"a":"b","c":"d"}|) == %{"a" => "b", "c" => "d"}
2121

22-
# note that 42 is a string here, not an integer
23-
assert select.(~s|{"a":42}|) == %{"a" => "42"}
22+
# note that 42 was a string in pre-25.0 and post-25.8 ClickHouse versions
23+
24+
assert select.(~s|{"a":42}|) == %{"a" => 42}
2425

2526
assert select.(~s|{}|) == %{}
2627

@@ -36,7 +37,7 @@ defmodule Ch.JSONTest do
3637
assert select.(~s|{"a":{"b":"c"}}|) == %{"a" => %{"b" => "c"}}
3738

3839
# numbers in arrays become strings
39-
assert select.(~s|{"a":[1,2,3]}|) == %{"a" => ["1", "2", "3"]}
40+
assert select.(~s|{"a":[1,2,3]}|) == %{"a" => [1, 2, 3]}
4041

4142
# this is weird, fields with dots are treated as nested objects
4243
assert select.(~s|{"a.b":"c"}|) == %{"a" => %{"b" => "c"}}
@@ -46,10 +47,10 @@ defmodule Ch.JSONTest do
4647
assert select.(~s|{"a":[null]}|) == %{"a" => [nil]}
4748

4849
# everything in an array gets converted to "lcd" type, aka string
49-
assert select.(~s|{"a":[1,3.14,"hello",null]}|) == %{"a" => ["1", "3.14", "hello", nil]}
50+
assert select.(~s|{"a":[1,3.14,"hello",null]}|) == %{"a" => [1, 3.14, "hello", nil]}
5051

5152
# but not if the array has nested objects, then the array becomes a tuple and can support mixed types
52-
assert select.(~s|{"a":[1,2.13,"s",{"a":"b"}]}|) == %{"a" => ["1", 2.13, "s", %{"a" => "b"}]}
53+
assert select.(~s|{"a":[1,2.13,"s",{"a":"b"}]}|) == %{"a" => [1, 2.13, "s", %{"a" => "b"}]}
5354
end
5455

5556
# https://clickhouse.com/docs/sql-reference/data-types/newjson#using-json-in-a-table-column-definition
@@ -67,9 +68,9 @@ defmodule Ch.JSONTest do
6768
conn,
6869
"SELECT json FROM json_test ORDER BY id"
6970
).rows == [
70-
[%{"a" => %{"b" => "42"}, "c" => ["1", "2", "3"]}],
71+
[%{"a" => %{"b" => 42}, "c" => [1, 2, 3]}],
7172
[%{"f" => "Hello, World!"}],
72-
[%{"a" => %{"b" => "43", "e" => "10"}, "c" => ["4", "5", "6"]}]
73+
[%{"a" => %{"b" => 43, "e" => 10}, "c" => [4, 5, 6]}]
7374
]
7475

7576
Ch.query!(
@@ -83,7 +84,7 @@ defmodule Ch.JSONTest do
8384
conn,
8485
"SELECT json FROM json_test where json.from = 'rowbinary'"
8586
).rows == [
86-
[%{"from" => "rowbinary", "some other" => "json value", "a" => %{"b" => "999"}}]
87+
[%{"from" => "rowbinary", "some other" => "json value", "a" => %{"b" => 999}}]
8788
]
8889

8990
assert Ch.query!(conn, "select json.a.b, json.a.g, json.c, json.d from json_test order by id").rows ==
@@ -110,9 +111,9 @@ defmodule Ch.JSONTest do
110111
conn,
111112
"SELECT json FROM json_test"
112113
).rows == [
113-
[%{"a" => %{"b" => 42}, "c" => ["1", "2", "3"]}],
114+
[%{"a" => %{"b" => 42}, "c" => [1, 2, 3]}],
114115
[%{"a" => %{"b" => 0}, "f" => "Hello, World!"}],
115-
[%{"a" => %{"b" => 43}, "c" => ["4", "5", "6"]}]
116+
[%{"a" => %{"b" => 43}, "c" => [4, 5, 6]}]
116117
]
117118
end
118119

@@ -131,9 +132,9 @@ defmodule Ch.JSONTest do
131132
conn,
132133
"SELECT json FROM json_test"
133134
).rows == [
134-
[%{"a" => %{"b" => 42, "g" => 42.42}, "c" => ["1", "2", "3"], "d" => "2020-01-01"}],
135+
[%{"a" => %{"b" => 42, "g" => 42.42}, "c" => [1, 2, 3], "d" => "2020-01-01"}],
135136
[%{"a" => %{"b" => 0}, "d" => "2020-01-02", "f" => "Hello, World!"}],
136-
[%{"a" => %{"b" => 43, "g" => 43.43}, "c" => ["4", "5", "6"]}]
137+
[%{"a" => %{"b" => 43, "g" => 43.43}, "c" => [4, 5, 6]}]
137138
]
138139

139140
assert Ch.query!(conn, "SELECT json.a.b, json.a.g, json.c, json.d FROM json_test").rows == [
@@ -204,24 +205,24 @@ defmodule Ch.JSONTest do
204205
assert Ch.query!(conn, "SELECT json FROM json_test;").rows == [
205206
[
206207
%{
207-
"a" => %{"b" => %{"c" => "42", "g" => 42.42}},
208-
"c" => ["1", "2", "3"],
209-
"d" => %{"e" => %{"f" => %{"g" => "Hello, World", "h" => ["1", "2", "3"]}}}
208+
"a" => %{"b" => %{"c" => 42, "g" => 42.42}},
209+
"c" => [1, 2, 3],
210+
"d" => %{"e" => %{"f" => %{"g" => "Hello, World", "h" => [1, 2, 3]}}}
210211
}
211212
],
212-
[%{"d" => %{"e" => %{"f" => %{"h" => ["4", "5", "6"]}}}, "f" => "Hello, World!"}],
213+
[%{"d" => %{"e" => %{"f" => %{"h" => [4, 5, 6]}}}, "f" => "Hello, World!"}],
213214
[
214215
%{
215-
"a" => %{"b" => %{"c" => "43", "e" => "10", "g" => 43.43}},
216-
"c" => ["4", "5", "6"]
216+
"a" => %{"b" => %{"c" => 43, "e" => 10, "g" => 43.43}},
217+
"c" => [4, 5, 6]
217218
}
218219
]
219220
]
220221

221222
assert Ch.query!(conn, "SELECT json.^a.b, json.^d.e.f FROM json_test;").rows == [
222-
[%{"c" => "42", "g" => 42.42}, %{"g" => "Hello, World", "h" => ["1", "2", "3"]}],
223-
[%{}, %{"h" => ["4", "5", "6"]}],
224-
[%{"c" => "43", "e" => "10", "g" => 43.43}, %{}]
223+
[%{"c" => 42, "g" => 42.42}, %{"g" => "Hello, World", "h" => [1, 2, 3]}],
224+
[%{}, %{"h" => [4, 5, 6]}],
225+
[%{"c" => 43, "e" => 10, "g" => 43.43}, %{}]
225226
]
226227
end
227228

@@ -243,33 +244,33 @@ defmodule Ch.JSONTest do
243244
"a" => %{
244245
"b" => [
245246
%{
246-
"c" => "42",
247+
"c" => 42,
247248
"d" => "Hello",
248249
"f" => [[%{"g" => 42.42}]],
249-
"k" => %{"j" => "1000"}
250+
"k" => %{"j" => 1000}
250251
},
251-
%{"c" => "43"},
252+
%{"c" => 43},
252253
%{
253254
"d" => "My",
254-
"e" => ["1", "2", "3"],
255+
"e" => [1, 2, 3],
255256
"f" => [[%{"g" => 43.43, "h" => "2020-01-01"}]],
256-
"k" => %{"j" => "2000"}
257+
"k" => %{"j" => 2000}
257258
}
258259
]
259260
}
260261
}
261262
],
262-
[%{"a" => %{"b" => ["1", "2", "3"]}}],
263+
[%{"a" => %{"b" => [1, 2, 3]}}],
263264
[
264265
%{
265266
"a" => %{
266267
"b" => [
267-
%{"c" => "44", "f" => [[%{"h" => "2020-01-02"}]]},
268+
%{"c" => 44, "f" => [[%{"h" => "2020-01-02"}]]},
268269
%{
269270
"d" => "World",
270-
"e" => ["4", "5", "6"],
271+
"e" => [4, 5, 6],
271272
"f" => [[%{"g" => 44.44}]],
272-
"k" => %{"j" => "3000"}
273+
"k" => %{"j" => 3000}
273274
}
274275
]
275276
}

0 commit comments

Comments
 (0)