Skip to content

Commit

Permalink
fix(flightsql): remove Any encoding of DoPutUpdateResult (#6825)
Browse files Browse the repository at this point in the history
  • Loading branch information
davisp authored Dec 4, 2024
1 parent 9047d99 commit 83dda05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions arrow-flight/src/sql/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ impl FlightSqlServiceClient<Channel> {
.await
.map_err(status_to_arrow_error)?
.unwrap();
let any = Any::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
let result: DoPutUpdateResult = any.unpack()?.unwrap();
let result: DoPutUpdateResult =
Message::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
Ok(result.record_count)
}

Expand Down Expand Up @@ -274,8 +274,8 @@ impl FlightSqlServiceClient<Channel> {
.await
.map_err(status_to_arrow_error)?
.unwrap();
let any = Any::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
let result: DoPutUpdateResult = any.unpack()?.unwrap();
let result: DoPutUpdateResult =
Message::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
Ok(result.record_count)
}

Expand Down Expand Up @@ -593,8 +593,8 @@ impl PreparedStatement<Channel> {
.await
.map_err(status_to_arrow_error)?
.unwrap();
let any = Any::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
let result: DoPutUpdateResult = any.unpack()?.unwrap();
let result: DoPutUpdateResult =
Message::decode(&*result.app_metadata).map_err(decode_error_to_arrow_error)?;
Ok(result.record_count)
}

Expand Down
8 changes: 4 additions & 4 deletions arrow-flight/src/sql/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,15 +719,15 @@ where
let record_count = self.do_put_statement_update(command, request).await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.as_any().encode_to_vec().into(),
app_metadata: result.encode_to_vec().into(),
})]);
Ok(Response::new(Box::pin(output)))
}
Command::CommandStatementIngest(command) => {
let record_count = self.do_put_statement_ingest(command, request).await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.as_any().encode_to_vec().into(),
app_metadata: result.encode_to_vec().into(),
})]);
Ok(Response::new(Box::pin(output)))
}
Expand All @@ -744,7 +744,7 @@ where
let record_count = self.do_put_substrait_plan(command, request).await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.as_any().encode_to_vec().into(),
app_metadata: result.encode_to_vec().into(),
})]);
Ok(Response::new(Box::pin(output)))
}
Expand All @@ -754,7 +754,7 @@ where
.await?;
let result = DoPutUpdateResult { record_count };
let output = futures::stream::iter(vec![Ok(PutResult {
app_metadata: result.as_any().encode_to_vec().into(),
app_metadata: result.encode_to_vec().into(),
})]);
Ok(Response::new(Box::pin(output)))
}
Expand Down

0 comments on commit 83dda05

Please sign in to comment.