Skip to content

Commit 579135b

Browse files
committed
fix: preserve inline warning and timing when following truncation
1 parent b3fa057 commit 579135b

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/query.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ fn resolve_inline(api: &Api, resp: hotdata::models::QueryResponse) -> QueryRespo
223223
return query_response_from_sdk(resp);
224224
}
225225
match resp.result_id.clone().flatten() {
226-
Some(result_id) => fetch_arrow_result(api, &result_id),
226+
Some(result_id) => {
227+
// The Arrow fetch returns only schema + rows; carry the query-level
228+
// warning and execution time the inline response reported, which
229+
// `arrow_result_to_query_response` otherwise hardcodes to None.
230+
let mut full = fetch_arrow_result(api, &result_id);
231+
full.warning = resp.warning.flatten();
232+
full.execution_time_ms = Some(resp.execution_time_ms.max(0) as u64);
233+
full
234+
}
227235
None => {
228236
let mut preview = query_response_from_sdk(resp);
229237
let note = "result truncated to a preview; full result unavailable (persistence not initiated)";
@@ -487,13 +495,22 @@ mod tests {
487495
.with_body(ipc)
488496
.create();
489497

498+
// The inline response carries a query-level warning and execution time
499+
// (execution_time_ms=5 from `truncated_preview`) that must survive the
500+
// Arrow follow, which otherwise hardcodes them to None.
501+
let mut resp = truncated_preview(Some("res_1"));
502+
resp.warning = Some(Some("approximate aggregate".to_string()));
503+
490504
let api = Api::test_new(&server.url(), "test-jwt", Some("ws-1"));
491-
let resolved = resolve_inline(&api, truncated_preview(Some("res_1")));
505+
let resolved = resolve_inline(&api, resp);
492506

493507
// Followed the truncated preview to the full 3-row result.
494508
assert_eq!(resolved.row_count, 3);
495509
assert_eq!(resolved.rows.len(), 3);
496510
assert_eq!(resolved.result_id.as_deref(), Some("res_1"));
511+
// Inline warning + timing carried through, not dropped by the fetch.
512+
assert_eq!(resolved.warning.as_deref(), Some("approximate aggregate"));
513+
assert_eq!(resolved.execution_time_ms, Some(5));
497514
m.assert();
498515
}
499516

0 commit comments

Comments
 (0)