[Java][FlightRPC] Flight SQL JDBC driver does not expose per-batch app_metadata from FlightStream
- Ngôn ngữ chính
- Java
- Star
- 94
- Fork
- 152
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
### Summary
The Flight SQL JDBC driver (flight-sql-jdbc-driver) currently exposes FlightInfo.app_metadata via ArrowFlightJdbcFlightStreamResultSet.getAppMetadata() (added in ~15.0), but per-batch app_metadata from FlightStream.getLatestMetadata() is received internally and silently discarded — it is never surfaced to JDBC callers.
### Motivation
Servers use per-batch app_metadata on FlightData messages to communicate execution statistics (rows scanned, elapsed time, query state, etc.) — similar to what Trino exposes via QueryStats. This is particularly valuable for the final batch, which servers commonly use as a "trailing metadata" pattern to report post-execution stats.
Currently there is no way to access this information through the JDBC layer without dropping down to the raw FlightClient, which defeats the purpose of the JDBC driver abstraction.
### Current behavior
FlightInfo.app_metadata → accessible via rs.unwrap(ArrowFlightJdbcFlightStreamResultSet.class).getAppMetadata() ✅
Per-batch FlightData.app_metadata → received by FlightStream.getLatestMetadata() internally, but never stored or exposed ❌
**Also worth noting**: getAppMetadata() returns a snapshot from query submission time only. For long-running queries using PollFlightInfo, updated app_metadata from subsequent poll cycles is never surfaced. This limits its usefulness for engines that progressively update stats during execution.
### Requested change
Add a method to ArrowFlightJdbcFlightStreamResultSet (accessible via unwrap()) such as:
```
public ArrowBuf getLatestBatchMetadata() {
if (currentEndpointData == null || currentEndpointData.getStream() == null) {
return null;
}
return currentEndpointData.getStream().getLatestMetadata();
}
```
This would follow the same unwrap() pattern already established for getAppMetadata() and give callers access to per-batch metadata, including trailing stats on the final batch.
### Component(s)
FlightRPC, Java
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với ArrowFlightJdbcFlightStreamResultSet và phương thức getAppMetadata() hiện có của nó, sau đó lần theo currentEndpointData và FlightStream.getLatestMetadata(). Hoàn thành khi các bên gọi JDBC có thể sử dụng unwrap() để lấy metadata mới nhất theo từng batch, bao gồm metadata theo sau từ batch cuối cùng, mà không cần truy cập FlightClient thô.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, sql
- Lĩnh vực
- api, database
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 75/100