Skip to content

Commit

Permalink
new json
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Feb 8, 2025
1 parent e70a3d3 commit 77a7afe
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/ch/connection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -568,18 +568,25 @@ defmodule Ch.ConnectionTest do
}} = Ch.query(conn, "SELECT * FROM t_uuid ORDER BY y")
end

@tag :skip
# https://clickhouse.com/docs/en/sql-reference/data-types/newjson
# https://clickhouse.com/docs/en/integrations/data-formats/json/overview
# https://clickhouse.com/blog/a-new-powerful-json-data-type-for-clickhouse
# https://clickhouse.com/blog/json-bench-clickhouse-vs-mongodb-elasticsearch-duckdb-postgresql
test "json", %{conn: conn} do

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.14, 25, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.14, 26, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.15, 25, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.15, 26, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.16, 25, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.16, 26, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.18, 27, latest, Europe/Berlin)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.17, 27, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.18, 27, latest, UTC)

test types json (Ch.ConnectionTest)

Check failure on line 575 in test/ch/connection_test.exs

View workflow job for this annotation

GitHub Actions / test (1.17.1, 27, 24.12.2.29, UTC)

test types json (Ch.ConnectionTest)
settings = [allow_experimental_object_type: 1]
settings = [enable_json_type: 1]

Ch.query!(conn, "CREATE TABLE json(o JSON) ENGINE = Memory", [], settings: settings)
Ch.query!(conn, "CREATE TABLE test_json(json JSON) ENGINE = Memory", [], settings: settings)

Ch.query!(conn, ~s|INSERT INTO json VALUES ('{"a": 1, "b": { "c": 2, "d": [1, 2, 3] }}')|)
Ch.query!(
conn,
~s|INSERT INTO test_json VALUES ('{"a" : {"b" : 42}, "c" : [1, 2, 3]}'), ('{"f" : "Hello, World!"}'), ('{"a" : {"b" : 43, "e" : 10}, "c" : [4, 5, 6]}')|
)

assert Ch.query!(conn, "SELECT o.a, o.b.c, o.b.d[3] FROM json").rows == [[1, 2, 3]]
assert Ch.query!(conn, "SELECT json FROM test_json") == :asdf

# named tuples are not supported yet
assert_raise ArgumentError, fn -> Ch.query!(conn, "SELECT o FROM json") end
assert Ch.query!(conn, "SELECT json.a, json.b.c, json.b.d[3] FROM test_json").rows == [
[1, 2, 3]
]
end

# TODO enum16
Expand Down

0 comments on commit 77a7afe

Please sign in to comment.