Skip to content

Commit

Permalink
Pass pull Request<FlightDescriptor> to FlightSqlService impls (#…
Browse files Browse the repository at this point in the history
…2309)

* Pass metadata to impl

* Pass up entire request

* Cleanup missed methods

* Import issue
  • Loading branch information
Brent Gardner authored Aug 5, 2022
1 parent 2683b06 commit 0af81e8
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 256 deletions.
152 changes: 113 additions & 39 deletions arrow-flight/examples/flight_sql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// under the License.

use arrow_flight::sql::{ActionCreatePreparedStatementResult, SqlInfo};
use arrow_flight::{FlightData, HandshakeRequest, HandshakeResponse};
use arrow_flight::{Action, FlightData, HandshakeRequest, HandshakeResponse, Ticket};
use futures::Stream;
use std::pin::Pin;
use tonic::transport::Server;
Expand Down Expand Up @@ -93,179 +93,253 @@ impl FlightSqlService for FlightSqlServiceImpl {
async fn get_flight_info_statement(
&self,
_query: CommandStatementQuery,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_statement not implemented",
))
}

async fn get_flight_info_prepared_statement(
&self,
_query: CommandPreparedStatementQuery,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_prepared_statement not implemented",
))
}

async fn get_flight_info_catalogs(
&self,
_query: CommandGetCatalogs,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_catalogs not implemented",
))
}

async fn get_flight_info_schemas(
&self,
_query: CommandGetDbSchemas,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_schemas not implemented",
))
}

async fn get_flight_info_tables(
&self,
_query: CommandGetTables,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_tables not implemented",
))
}

async fn get_flight_info_table_types(
&self,
_query: CommandGetTableTypes,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_table_types not implemented",
))
}

async fn get_flight_info_sql_info(
&self,
_query: CommandGetSqlInfo,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_sql_info not implemented",
))
}

async fn get_flight_info_primary_keys(
&self,
_query: CommandGetPrimaryKeys,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_primary_keys not implemented",
))
}

async fn get_flight_info_exported_keys(
&self,
_query: CommandGetExportedKeys,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_exported_keys not implemented",
))
}

async fn get_flight_info_imported_keys(
&self,
_query: CommandGetImportedKeys,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_imported_keys not implemented",
))
}

async fn get_flight_info_cross_reference(
&self,
_query: CommandGetCrossReference,
_request: FlightDescriptor,
_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"get_flight_info_imported_keys not implemented",
))
}

// do_get
async fn do_get_statement(
&self,
_ticket: TicketStatementQuery,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_statement not implemented"))
}

async fn do_get_prepared_statement(
&self,
_query: CommandPreparedStatementQuery,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_get_prepared_statement not implemented",
))
}

async fn do_get_catalogs(
&self,
_query: CommandGetCatalogs,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_catalogs not implemented"))
}

async fn do_get_schemas(
&self,
_query: CommandGetDbSchemas,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_schemas not implemented"))
}

async fn do_get_tables(
&self,
_query: CommandGetTables,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_tables not implemented"))
}

async fn do_get_table_types(
&self,
_query: CommandGetTableTypes,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_table_types not implemented"))
}

async fn do_get_sql_info(
&self,
_query: CommandGetSqlInfo,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_sql_info not implemented"))
}

async fn do_get_primary_keys(
&self,
_query: CommandGetPrimaryKeys,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented("do_get_primary_keys not implemented"))
}

async fn do_get_exported_keys(
&self,
_query: CommandGetExportedKeys,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_get_exported_keys not implemented",
))
}

async fn do_get_imported_keys(
&self,
_query: CommandGetImportedKeys,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_get_imported_keys not implemented",
))
}

async fn do_get_cross_reference(
&self,
_query: CommandGetCrossReference,
_request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_get_cross_reference not implemented",
))
}

// do_put
async fn do_put_statement_update(
&self,
_ticket: CommandStatementUpdate,
_request: Request<Streaming<FlightData>>,
) -> Result<i64, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_put_statement_update not implemented",
))
}

async fn do_put_prepared_statement_query(
&self,
_query: CommandPreparedStatementQuery,
_request: Streaming<FlightData>,
_request: Request<Streaming<FlightData>>,
) -> Result<Response<<Self as FlightService>::DoPutStream>, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_put_prepared_statement_query not implemented",
))
}

async fn do_put_prepared_statement_update(
&self,
_query: CommandPreparedStatementUpdate,
_request: Streaming<FlightData>,
_request: Request<Streaming<FlightData>>,
) -> Result<i64, Status> {
Err(Status::unimplemented("Not yet implemented"))
Err(Status::unimplemented(
"do_put_prepared_statement_update not implemented",
))
}

// do_action
async fn do_action_create_prepared_statement(
&self,
_query: ActionCreatePreparedStatementRequest,
_request: Request<Action>,
) -> Result<ActionCreatePreparedStatementResult, Status> {
Err(Status::unimplemented("Not yet implemented"))
}
async fn do_action_close_prepared_statement(
&self,
_query: ActionClosePreparedStatementRequest,
_request: Request<Action>,
) {
unimplemented!("Not yet implemented")
}
Expand Down
Loading

0 comments on commit 0af81e8

Please sign in to comment.