This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new f4fde769ab Revert "Box `FlightErrror::tonic` to reduce size (fixes
nightly clippy) (#7229)" (#7266)
f4fde769ab is described below
commit f4fde769ab6e1a9b75f890b7f8b47bc22800830b
Author: Marco Neumann <[email protected]>
AuthorDate: Tue Mar 11 16:28:10 2025 +0100
Revert "Box `FlightErrror::tonic` to reduce size (fixes nightly clippy)
(#7229)" (#7266)
This reverts commit 9e9102945d1f508fce155ddd0721ee38a383cf9d.
---
arrow-flight/src/client.rs | 8 ++++----
arrow-flight/src/error.rs | 12 +++---------
arrow-flight/src/sql/client.rs | 2 +-
arrow-flight/src/streams.rs | 2 +-
4 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/arrow-flight/src/client.rs b/arrow-flight/src/client.rs
index 9b4c10e9a0..97d9899a9f 100644
--- a/arrow-flight/src/client.rs
+++ b/arrow-flight/src/client.rs
@@ -210,7 +210,7 @@ impl FlightClient {
let (response_stream, trailers) =
extract_lazy_trailers(response_stream);
Ok(FlightRecordBatchStream::new_from_flight_data(
- response_stream.map_err(|status| status.into()),
+ response_stream.map_err(FlightError::Tonic),
)
.with_headers(md)
.with_trailers(trailers))
@@ -470,7 +470,7 @@ impl FlightClient {
.list_flights(request)
.await?
.into_inner()
- .map_err(|status| status.into());
+ .map_err(FlightError::Tonic);
Ok(response.boxed())
}
@@ -537,7 +537,7 @@ impl FlightClient {
.list_actions(request)
.await?
.into_inner()
- .map_err(|status| status.into());
+ .map_err(FlightError::Tonic);
Ok(action_stream.boxed())
}
@@ -575,7 +575,7 @@ impl FlightClient {
.do_action(request)
.await?
.into_inner()
- .map_err(|status| status.into())
+ .map_err(FlightError::Tonic)
.map(|r| {
r.map(|r| {
// unwrap inner bytes
diff --git a/arrow-flight/src/error.rs b/arrow-flight/src/error.rs
index ac80305832..499706e1ed 100644
--- a/arrow-flight/src/error.rs
+++ b/arrow-flight/src/error.rs
@@ -27,7 +27,7 @@ pub enum FlightError {
/// Returned when functionality is not yet available.
NotYetImplemented(String),
/// Error from the underlying tonic library
- Tonic(Box<tonic::Status>),
+ Tonic(tonic::Status),
/// Some unexpected message was received
ProtocolError(String),
/// An error occurred during decoding
@@ -74,7 +74,7 @@ impl Error for FlightError {
impl From<tonic::Status> for FlightError {
fn from(status: tonic::Status) -> Self {
- Self::Tonic(Box::new(status))
+ Self::Tonic(status)
}
}
@@ -91,7 +91,7 @@ impl From<FlightError> for tonic::Status {
match value {
FlightError::Arrow(e) => tonic::Status::internal(e.to_string()),
FlightError::NotYetImplemented(e) => tonic::Status::internal(e),
- FlightError::Tonic(status) => *status,
+ FlightError::Tonic(status) => status,
FlightError::ProtocolError(e) => tonic::Status::internal(e),
FlightError::DecodeError(e) => tonic::Status::internal(e),
FlightError::ExternalError(e) =>
tonic::Status::internal(e.to_string()),
@@ -147,10 +147,4 @@ mod test {
let source = root_error.downcast_ref::<FlightError>().unwrap();
assert!(matches!(source, FlightError::DecodeError(_)));
}
-
- #[test]
- fn test_error_size() {
- // use Box in variants to keep this size down
- assert_eq!(std::mem::size_of::<FlightError>(), 32);
- }
}
diff --git a/arrow-flight/src/sql/client.rs b/arrow-flight/src/sql/client.rs
index 6791b68b75..6d3ac3dbe6 100644
--- a/arrow-flight/src/sql/client.rs
+++ b/arrow-flight/src/sql/client.rs
@@ -309,7 +309,7 @@ impl FlightSqlServiceClient<Channel> {
let (response_stream, trailers) =
extract_lazy_trailers(response_stream);
Ok(FlightRecordBatchStream::new_from_flight_data(
- response_stream.map_err(|status| status.into()),
+ response_stream.map_err(FlightError::Tonic),
)
.with_headers(md)
.with_trailers(trailers))
diff --git a/arrow-flight/src/streams.rs b/arrow-flight/src/streams.rs
index ab49612201..e532a80e1e 100644
--- a/arrow-flight/src/streams.rs
+++ b/arrow-flight/src/streams.rs
@@ -127,7 +127,7 @@ impl<T> Stream for FallibleTonicResponseStream<T> {
match ready!(pinned.response_stream.poll_next_unpin(cx)) {
Some(Ok(res)) => Poll::Ready(Some(Ok(res))),
- Some(Err(status)) => Poll::Ready(Some(Err(status.into()))),
+ Some(Err(status)) =>
Poll::Ready(Some(Err(FlightError::Tonic(status)))),
None => Poll::Ready(None),
}
}