Skip to content

Commit 75bc0ab

Browse files
authored
Merge pull request #158 from hotdata-dev/fix/drop-deprecated-query-row-count
fix: stop using deprecated QueryResponse.row_count
2 parents 3061b7d + 2f393af commit 75bc0ab

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/query.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ pub struct QueryResponse {
1414

1515
/// Convert the SDK's inline `QueryResponse` (200 path) into the CLI's display
1616
/// model. The async path decodes Arrow instead (see `fetch_arrow_result`).
17+
///
18+
/// `row_count` is derived from `rows.len()` — the rows actually carried in this
19+
/// body — rather than the deprecated SDK `row_count` field. This path only ever
20+
/// renders the rows it holds: a non-truncated response carries the whole result,
21+
/// and the truncated-without-`result_id` fallback keeps just the preview (with a
22+
/// warning). A truncated result that *can* be fetched never reaches here — it's
23+
/// followed to the full set via Arrow in `resolve_inline`. So counting the held
24+
/// rows can never overstate or understate what the user sees.
1725
fn query_response_from_sdk(resp: hotdata::models::QueryResponse) -> QueryResponse {
1826
QueryResponse {
1927
result_id: resp.result_id.flatten(),
2028
columns: resp.columns,
29+
row_count: resp.rows.len() as u64,
2130
rows: resp.rows,
22-
row_count: resp.row_count.max(0) as u64,
2331
execution_time_ms: Some(resp.execution_time_ms.max(0) as u64),
2432
warning: resp.warning.flatten(),
2533
}

0 commit comments

Comments
 (0)