(
&self,
_request: Request<Ticket>,
message: Any,
)
| 245 | } |
| 246 | |
| 247 | async fn do_get_fallback( |
| 248 | &self, |
| 249 | _request: Request<Ticket>, |
| 250 | message: Any, |
| 251 | ) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> { |
| 252 | if !message.is::<FetchResults>() { |
| 253 | Err(Status::unimplemented(format!( |
| 254 | "do_get: The defined request is invalid: {}", |
| 255 | message.type_url |
| 256 | )))? |
| 257 | } |
| 258 | |
| 259 | let fr: FetchResults = message |
| 260 | .unpack() |
| 261 | .map_err(|e| Status::internal(format!("{e:?}")))? |
| 262 | .ok_or_else(|| Status::internal("Expected FetchResults but got None!"))?; |
| 263 | |
| 264 | let handle = fr.handle; |
| 265 | |
| 266 | info!("getting results for {handle}"); |
| 267 | let result = self.get_result(&handle)?; |
| 268 | // if we get an empty result, create an empty schema |
| 269 | let (schema, batches) = match result.first() { |
| 270 | None => (Arc::new(Schema::empty()), vec![]), |
| 271 | Some(batch) => (batch.schema(), result.clone()), |
| 272 | }; |
| 273 | |
| 274 | let batch_stream = futures::stream::iter(batches).map(Ok); |
| 275 | |
| 276 | let stream = FlightDataEncoderBuilder::new() |
| 277 | .with_schema(schema) |
| 278 | .build(batch_stream) |
| 279 | .map_err(Status::from); |
| 280 | |
| 281 | Ok(Response::new(Box::pin(stream))) |
| 282 | } |
| 283 | |
| 284 | async fn get_flight_info_prepared_statement( |
| 285 | &self, |
nothing calls this directly
no test coverage detected