Skip to content

Commit

Permalink
feat(flight-sql): Allow custom commands in get-flight-info (#4997)
Browse files Browse the repository at this point in the history
  • Loading branch information
amartins23 committed Oct 30, 2023
1 parent 11b2f5f commit 890823b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions arrow-flight/src/sql/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ pub trait FlightSqlService: Sync + Send + Sized + 'static {
))
}

/// Implementors may override to handle additional calls to get_flight_info()
async fn get_flight_info_fallback(
&self,
cmd: Command,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented(format!(
"get_flight_info: The defined request is invalid: {}",
cmd.type_url()
)))
}

// do_get

/// Get a FlightDataStream containing the query results.
Expand Down Expand Up @@ -616,10 +628,7 @@ where
Command::CommandGetXdbcTypeInfo(token) => {
self.get_flight_info_xdbc_type_info(token, request).await
}
cmd => Err(Status::unimplemented(format!(
"get_flight_info: The defined request is invalid: {}",
cmd.type_url()
))),
cmd => self.get_flight_info_fallback(cmd, request).await,
}
}

Expand Down

0 comments on commit 890823b

Please sign in to comment.