@@ -79,21 +79,25 @@ impl DDProxyHandler {
7979 }
8080 }
8181
82- pub fn create_flight_info_response ( & self , query_plan : QueryPlan ) -> Result < FlightInfo , Status > {
82+ pub fn create_flight_info_response (
83+ & self ,
84+ query_plan : QueryPlan ,
85+ ) -> Result < FlightInfo , Box < Status > > {
8386 let mut flight_info = FlightInfo :: new ( )
8487 . try_with_schema ( & query_plan. schema )
85- . map_err ( |e| Status :: internal ( format ! ( "Could not create flight info {e:?}" ) ) ) ?;
88+ . map_err ( |e| {
89+ Box :: new ( Status :: internal ( format ! (
90+ "Could not create flight info {e:?}"
91+ ) ) )
92+ } ) ?;
8693
8794 let ticket_data = TicketStatementData {
8895 query_id : query_plan. query_id ,
8996 stage_id : query_plan. final_stage_id ,
9097 stage_addrs : Some ( query_plan. worker_addresses . into ( ) ) ,
91- schema : Some (
92- query_plan
93- . schema
94- . try_into ( )
95- . map_err ( |e| Status :: internal ( format ! ( "Could not convert schema {e:?}" ) ) ) ?,
96- ) ,
98+ schema : Some ( query_plan. schema . try_into ( ) . map_err ( |e| {
99+ Box :: new ( Status :: internal ( format ! ( "Could not convert schema {e:?}" ) ) )
100+ } ) ?) ,
97101 } ;
98102
99103 let ticket = Ticket :: new (
@@ -153,18 +157,18 @@ impl DDProxyHandler {
153157 & self ,
154158 addrs : & Addrs ,
155159 expected_stage_id : u64 ,
156- ) -> Result < ( ) , Status > {
160+ ) -> Result < ( ) , Box < Status > > {
157161 if addrs. len ( ) != 1 {
158- return Err ( Status :: internal ( format ! (
162+ return Err ( Box :: new ( Status :: internal ( format ! (
159163 "Expected exactly one stage in addrs, got {}" ,
160164 addrs. len( )
161- ) ) ) ;
165+ ) ) ) ) ;
162166 }
163167 if !addrs. contains_key ( & expected_stage_id) {
164- return Err ( Status :: internal ( format ! (
168+ return Err ( Box :: new ( Status :: internal ( format ! (
165169 "No addresses found for stage_id {} in addrs" ,
166170 expected_stage_id
167- ) ) ) ;
171+ ) ) ) ) ;
168172 }
169173 Ok ( ( ) )
170174 }
@@ -257,7 +261,8 @@ impl FlightSqlHandler for DDProxyHandler {
257261 trace ! ( "calculated addrs: {:?}" , addrs) ;
258262
259263 // Validate that addrs contains exactly one stage
260- self . validate_single_stage_addrs ( & addrs, tsd. stage_id ) ?;
264+ self . validate_single_stage_addrs ( & addrs, tsd. stage_id )
265+ . map_err ( |e| * e) ?;
261266
262267 let stage_partition_addrs = addrs. get ( & tsd. stage_id ) . ok_or_else ( || {
263268 Status :: internal ( format ! (
@@ -357,6 +362,7 @@ impl DDProxyService {
357362 handler : self . handler . clone ( ) ,
358363 } ;
359364
365+ #[ allow( clippy:: result_large_err) ]
360366 fn intercept ( req : Request < ( ) > ) -> Result < Request < ( ) > , Status > {
361367 println ! ( "Intercepting request: {:?}" , req) ;
362368 debug ! ( "Intercepting request: {:?}" , req) ;
0 commit comments