Skip to content

Commit

Permalink
fix(driver): kill instead of finish query for query row
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Oct 6, 2023
1 parent 479d4a2 commit 7fd0bde
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions driver/src/rest_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Connection for RestAPIConnection {
async fn query_row(&self, sql: &str) -> Result<Option<Row>> {
let resp = self.client.query(sql).await?;
let resp = self.wait_for_data(resp).await?;
self.finish_query(resp.final_uri).await?;
self.kill_query(&resp).await?;
let schema = resp.schema.try_into()?;
if resp.data.is_empty() {
Ok(None)
Expand Down Expand Up @@ -152,10 +152,10 @@ impl<'o> RestAPIConnection {
Ok(result)
}

async fn finish_query(&self, final_uri: Option<String>) -> Result<QueryResponse> {
match final_uri {
Some(uri) => self.client.query_page(&uri).await.map_err(|e| e.into()),
None => Err(Error::InvalidResponse("final_uri is empty".to_string())),
async fn kill_query(&self, resp: &QueryResponse) -> Result<QueryResponse> {
match &resp.kill_uri {
Some(uri) => self.client.query_page(uri).await.map_err(|e| e.into()),
None => Err(Error::InvalidResponse("kill_uri is empty".to_string())),
}
}

Expand Down

0 comments on commit 7fd0bde

Please sign in to comment.