ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 534 forks source link

[client-v2] JSON Support #1833

Open chernser opened 1 month ago

chernser commented 1 month ago

Description

Client should support JSON Data type (https://clickhouse.com/docs/en/integrations/data-formats/json/overview).

Considerations:


See also:

dzmitry-biatenia-smop commented 13 hours ago

@chernser any idea when 0.7.2 Java client will be released?

chernser commented 13 hours ago

Hi @dzmitry-biatenia-smop! We plan to release 0.7.2 by end of November. However this functionality is not in the 0.7.2: it is a complex and experimental feature - so it will take time to add it to the client. However 0.7.2 might have a minimal support when JSON columns can be read/written as a string.

How would you use JSON? Do you have a DTO object or do you work directly with some generic classes generated by GSON or Jackson ?

Thanks!

dzmitry-biatenia-smop commented 9 hours ago

@chernser the basic case - I was able to create a column with JSON type in Clickhouse table with flag _allow_experimental_jsontype enabled, and even was able to insert some JSON data there with com.clickhouse.client.api.Client#execute(), but when can running any com.clickhouse.client.api.Client.query("select * from table_with_json_column") I'm getting Unsupported format: "JSON" coming from here because response has JSON type here. I tried to set _output_format_binary_write_json_asstring , but seems it's not supported by my version of server 24.8.4

chernser commented 8 hours ago

@dzmitry-biatenia-smop I will fix this issue for sure.

dzmitry-biatenia-smop commented 6 hours ago

@chernser are you going to release that fix separately? any ETA for that fix?

chernser commented 6 hours ago

@dzmitry-biatenia-smop patch should be release by end of this week. release is by end of the month another option is to take nightly build.

dzmitry-biatenia-smop commented 5 hours ago

@chernser can you please notify me when that patch is ready or point me to the correct nightly build?

chernser commented 5 hours ago

@dzmitry-biatenia-smop yes, sure!