diff --git a/arrow-flight/src/sql/client.rs b/arrow-flight/src/sql/client.rs index 29782a2bc44b..c01f20e05412 100644 --- a/arrow-flight/src/sql/client.rs +++ b/arrow-flight/src/sql/client.rs @@ -552,10 +552,9 @@ impl PreparedStatement { &self, put_result: &PutResult, ) -> Result, ArrowError> { - let any = Any::decode(&*put_result.app_metadata).map_err(decode_error_to_arrow_error)?; - Ok(any - .unpack::()? - .and_then(|result| result.prepared_statement_handle)) + let result: DoPutPreparedStatementResult = + Message::decode(&*put_result.app_metadata).map_err(decode_error_to_arrow_error)?; + Ok(result.prepared_statement_handle) } /// Close the prepared statement, so that this PreparedStatement can not used diff --git a/arrow-flight/src/sql/server.rs b/arrow-flight/src/sql/server.rs index c18024cf068a..b47691c7da5d 100644 --- a/arrow-flight/src/sql/server.rs +++ b/arrow-flight/src/sql/server.rs @@ -718,7 +718,7 @@ where .do_put_prepared_statement_query(command, request) .await?; 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))) }