ClickHouse / ClickHouse/clickhouse-java

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

Offen
#2,509 14 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
client-api-v2 enhancement
Vorherrschende Sprache
Java
Sterne
1.6k
Forks
636
Ø Merge
2 T. 23 Std.
Gemergte PRs (30 T.)
29

Beschreibung

### 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
}
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Lies zunächst RowBinaryFormatWriter und die in der Issue gezeigte ClickHouse Client v2 insert API, um den bestehenden Writer-Vertrag und die Formatauswahl zu verstehen. Füge eine gleichwertige Unterstützung für NativeFormatWriter hinzu, damit Einfügeoperationen ClickHouseFormat.Native verwenden können, und verifiziere anschließend, dass das Batch-Einfügen im Native-Format für die angeforderte API funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
40/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.