Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CommandGetXdbcTypeInfo to Flight SQL Server #4055

Merged
merged 4 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions arrow-flight/examples/flight_sql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ impl FlightSqlService for FlightSqlServiceImpl {
))
}

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

// do_get
async fn do_get_statement(
&self,
Expand Down Expand Up @@ -412,6 +422,16 @@ impl FlightSqlService for FlightSqlServiceImpl {
))
}

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

// do_put
async fn do_put_statement_update(
&self,
Expand Down
26 changes: 23 additions & 3 deletions arrow-flight/src/sql/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use super::{
ActionCreatePreparedStatementResult, CommandGetCatalogs, CommandGetCrossReference,
CommandGetDbSchemas, CommandGetExportedKeys, CommandGetImportedKeys,
CommandGetPrimaryKeys, CommandGetSqlInfo, CommandGetTableTypes, CommandGetTables,
CommandPreparedStatementQuery, CommandPreparedStatementUpdate, CommandStatementQuery,
CommandStatementUpdate, DoPutUpdateResult, ProstMessageExt, SqlInfo,
TicketStatementQuery,
CommandGetXdbcTypeInfo, CommandPreparedStatementQuery,
CommandPreparedStatementUpdate, CommandStatementQuery, CommandStatementUpdate,
DoPutUpdateResult, ProstMessageExt, SqlInfo, TicketStatementQuery,
};

pub(crate) static CREATE_PREPARED_STATEMENT: &str = "CreatePreparedStatement";
Expand Down Expand Up @@ -151,6 +151,13 @@ pub trait FlightSqlService: Sync + Send + Sized + 'static {
request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status>;

/// Get a FlightInfo to extract information about the supported XDBC types.
async fn get_flight_info_xdbc_type_info(
&self,
query: CommandGetXdbcTypeInfo,
request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status>;

// do_get

/// Get a FlightDataStream containing the query results.
Expand Down Expand Up @@ -230,6 +237,13 @@ pub trait FlightSqlService: Sync + Send + Sized + 'static {
request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status>;

/// Get a FlightDataStream containing the data related to the supported XDBC types.
async fn do_get_xdbc_type_info(
&self,
query: CommandGetXdbcTypeInfo,
request: Request<Ticket>,
) -> Result<Response<<Self as FlightService>::DoGetStream>, Status>;

// do_put

/// Execute an update SQL statement.
Expand Down Expand Up @@ -352,6 +366,9 @@ where
Command::CommandGetCrossReference(token) => {
self.get_flight_info_cross_reference(token, request).await
}
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()
Expand Down Expand Up @@ -407,6 +424,9 @@ where
Command::CommandGetCrossReference(command) => {
self.do_get_cross_reference(command, request).await
}
Command::CommandGetXdbcTypeInfo(command) => {
self.do_get_xdbc_type_info(command, request).await
}
cmd => self.do_get_fallback(request, cmd.into_any()).await,
}
}
Expand Down