ClickHouse / ClickHouse/clickhouse-java

Example of migration from ClickHouseRowBinaryStream

Ouverte
#2,239 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
client-api-v2 enhancement question
Langage dominant
Java
Étoiles
1.6k
Forks
636
Merge moyen
2 j 23 h
PR mergées (30 j)
29

Description

### Use case
For users, migrating from old client

### Describe the solution you'd like
...

### Describe the alternatives you've considered
...

### Additional context
I have code, that insert `(UUID, UUID, UUID, byte[])` objects with `clickhouse-jdbc:0.3.1-patch`:
```java
@Override
protected ProcessorResult send(List events) throws BackendServiceFailedException {
var sentEvents = new LinkedList();
try (ClickHouseStatement statement = this.connection.createStatement()) {
statement.write().send(
"INSERT INTO tracing_spans_local (trace_id, parent_span_id, span_id, payload)",
stream -> {
for (var event : events) {
write(stream, sinkEvent.getInternalEvent())
}
},
ClickHouseFormat.RowBinary);

@Override
protected boolean write(ClickHouseRowBinaryStream stream, Event event) throws IOException {
// ...
stream.writeUUID(traceId.get());
stream.writeUUID(parentSpanId.orElse(DEFAULT_UUID));
stream.writeUUID(spanId.get());
stream.writeUnsignedLeb128(event.getBytes().length);
stream.writeBytes(event.getBytes());
```

Now I'm trying to updage to `client-v2:0.8.2` and have no idea how to rewrite this. Tried to use `RowBinaryFormatWriter`, but it looks very complex and have no docs. Probably, it's not for client use?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by comparing the old ClickHouseRowBinaryStream usage with the client-v2 RowBinaryFormatWriter entry point and the JDBC client API mentioned in the issue. Document the equivalent migration for UUIDs, the length-prefixed payload, and byte data, with a complete example showing how the insert is sent.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
clickhouse, java
Domaine
api, documentation
Type d'issue
Documentation
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
À clarifier
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.