Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion client-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,26 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import com.clickhouse.client.api.command.CommandResponse;
import com.clickhouse.client.api.command.CommandSettings;
import com.clickhouse.client.api.data_formats.ClickHouseBinaryFormatReader;
import com.clickhouse.client.api.data_formats.JSONEachRowFormatReader;
import com.clickhouse.client.api.data_formats.NativeFormatReader;
import com.clickhouse.client.api.data_formats.RowBinaryFormatReader;
import com.clickhouse.client.api.data_formats.RowBinaryWithNamesAndTypesFormatReader;
import com.clickhouse.client.api.data_formats.RowBinaryWithNamesFormatReader;
import com.clickhouse.client.api.data_formats.internal.BinaryStreamReader;
import com.clickhouse.client.api.data_formats.internal.JsonParser;
import com.clickhouse.client.api.data_formats.internal.JsonParserFactory;
import com.clickhouse.client.api.data_formats.internal.MapBackedRecord;
import com.clickhouse.client.api.data_formats.internal.ProcessParser;
import com.clickhouse.client.api.enums.Protocol;
Expand Down Expand Up @@ -2077,6 +2080,11 @@ public ClickHouseBinaryFormatReader newBinaryFormatReader(QueryResponse response
reader = new RowBinaryFormatReader(response.getInputStream(), response.getSettings(), schema,
byteBufferPool, typeHintMapping);
break;
case JSONEachRow:
String jsonProcessor = ClientConfigProperties.JSON_PROCESSOR.getOrDefault(configuration);
JsonParser parser = JsonParserFactory.createParser(jsonProcessor, response.getInputStream());
reader = new JSONEachRowFormatReader(parser);
break;
default:
throw new IllegalArgumentException("Binary readers doesn't support format: " + response.getFormat());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ public Object parseValue(String value) {
* See <a href="https://clickhouse.com/docs/operations/settings/query-level#custom_settings">ClickHouse Docs</a>
*/
CUSTOM_SETTINGS_PREFIX("custom_settings_prefix", String.class, "custom_"),

/**
* Configures what JSON processor will be used for JSON formats. Choices:
* <ul>
* <li>JACKSON - uses Jackson library.</li>
* <li>GSON - uses Gson library.</li>
* </ul>
*/
JSON_PROCESSOR("json_processor", String.class, "JACKSON"),
;

private static final Logger LOG = LoggerFactory.getLogger(ClientConfigProperties.class);
Expand Down
Loading
Loading