ClickHouse / ClickHouse/clickhouse-java

Example of migration from ClickHouseRowBinaryStream

Đang mở
#2,239 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
client-api-v2 enhancement question
Ngôn ngữ chính
Java
Star
1.6k
Fork
636
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
29

Mô tả

### 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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách so sánh cách sử dụng ClickHouseRowBinaryStream trước đây với entry point client-v2 RowBinaryFormatWriter và JDBC client API được đề cập trong issue. Ghi lại cách migration tương đương cho UUIDs, payload có tiền tố độ dài và dữ liệu byte, kèm một ví dụ hoàn chỉnh cho thấy cách gửi insert.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
clickhouse, java
Lĩnh vực
api, documentation
Loại issue
Tài liệu
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.