Skip to content

Commit d4a95e6

Browse files
eddietejedaclaude
andcommitted
fix(query): two issues from Codex review
- Rename QueryRunResponse.error -> error_message to match the actual server field name; previously failed async queries always printed "query failed: unknown error" instead of the real message - Make fetch_arrow_result pub(crate) and use it in results::get so that `hotdata results get <id>` fetches Arrow IPC like the rest of the query path, rather than falling back to JSON Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9426946 commit d4a95e6

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/query.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct QueryRunResponse {
2626
status: String,
2727
result_id: Option<String>,
2828
#[serde(default)]
29-
error: Option<String>,
29+
error_message: Option<String>,
3030
}
3131

3232
fn value_to_string(v: &Value) -> String {
@@ -132,7 +132,7 @@ fn arrow_ipc_to_query_response(bytes: Vec<u8>, result_id: String) -> QueryRespon
132132
}
133133

134134
/// Fetch `/results/{result_id}` as Arrow IPC and return a `QueryResponse`.
135-
fn fetch_arrow_result(api: &ApiClient, result_id: &str) -> QueryResponse {
135+
pub(crate) fn fetch_arrow_result(api: &ApiClient, result_id: &str) -> QueryResponse {
136136
let (status, bytes) = api.get_bytes(&format!("/results/{result_id}"), ACCEPT_ARROW);
137137
if !status.is_success() {
138138
use crossterm::style::Stylize;
@@ -214,7 +214,7 @@ pub fn execute(
214214
"failed" => {
215215
spinner.finish_and_clear();
216216
use crossterm::style::Stylize;
217-
let err = run.error.as_deref().unwrap_or("unknown error");
217+
let err = run.error_message.as_deref().unwrap_or("unknown error");
218218
eprintln!("{}", format!("query failed: {err}").red());
219219
std::process::exit(1);
220220
}
@@ -274,7 +274,7 @@ pub fn poll(query_run_id: &str, workspace_id: &str, format: &str) {
274274
},
275275
"failed" => {
276276
use crossterm::style::Stylize;
277-
let err = run.error.as_deref().unwrap_or("unknown error");
277+
let err = run.error_message.as_deref().unwrap_or("unknown error");
278278
eprintln!("{}", format!("query failed: {err}").red());
279279
std::process::exit(1);
280280
}

src/results.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ pub fn list(workspace_id: &str, limit: Option<u32>, offset: Option<u32>, format:
6464

6565
pub fn get(result_id: &str, workspace_id: &str, format: &str) {
6666
let api = ApiClient::new(Some(workspace_id));
67-
68-
let path = format!("/results/{result_id}");
69-
let result: crate::query::QueryResponse = api.get(&path);
70-
67+
let result = crate::query::fetch_arrow_result(&api, result_id);
7168
crate::query::print_result(&result, format);
7269
}

0 commit comments

Comments
 (0)