ClickHouse / ClickHouse/clickhouse-java

[client-v2]Add NativeFormatWriter support to ClickHous Client v2

Open
#2,509 14 comments 2 reactions 0 assignees View on GitHub
client-api-v2 enhancement
Dominant language
Java
Stars
1.6k
Forks
636
Avg merge
2d 16h
Merged PRs (30d)
28

Description

### Use case
Currently, the ClickHouse Java Client v2 only supports `RowBinaryFormatWriter` for batch insertions, but does not provide `NativeFormatWriter` support. The `Native` format typically offers better performance compared to `RowBinary` format for high-throughput scenarios. We have a high-throughput application that needs to insert large batches of data into ClickHouse. Our current implementation uses `RowBinary` format:
```java
ClickHouseFormat format = ClickHouseFormat.RowBinary; // Currently limited options
try (InsertResponse response = clickhouseClient.insert(TABLE_NAME, out -> {
RowBinaryFormatWriter writer = new RowBinaryFormatWriter(out, tableSchema, format);
// ... data writing logic
}, format, new InsertSettings())) {
// ... handle response
}
```

### Describe the solution you'd like
We would like to use `Native` format for better performance:
```java
ClickHouseFormat format = ClickHouseFormat.Native; // Desired functionality
try (InsertResponse response = clickhouseClient.insert(TABLE_NAME, out -> {
NativeFormatWriter writer = new NativeFormatWriter(out, tableSchema, format); // Desired API
// ... data writing logic
}, format, new InsertSettings())) {
// ... handle response
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.