fix: do not panic on unimplemented (#7765)

pull/24376/head
Andrew Lamb 2023-05-08 11:13:54 -04:00 committed by GitHub
parent dc1a9e9ed6
commit be6bcdef45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -19,7 +19,7 @@ use arrow_flight::{
};
use arrow_util::flight::prepare_schema_for_flight;
use bytes::Bytes;
use datafusion::{logical_expr::LogicalPlan, physical_plan::ExecutionPlan};
use datafusion::{error::DataFusionError, logical_expr::LogicalPlan, physical_plan::ExecutionPlan};
use iox_query::{exec::IOxSessionContext, QueryNamespace};
use observability_deps::tracing::debug;
use once_cell::sync::Lazy;
@ -434,7 +434,9 @@ async fn plan_get_xdbc_type_info(
match data_type {
None => Ok(ctx.batch_to_logical_plan(TYPE_INFO_RECORD_BATCH.clone())?),
// TODO chunchun: support search by data_type
Some(_data_type) => unimplemented!("filter by data_type is not implemented yet"),
Some(_data_type) => Err(Error::from(DataFusionError::NotImplemented(
"GetXdbcTypeInfo does not yet support filtering by data_type".to_string(),
))),
}
}

View File

@ -1149,7 +1149,6 @@ async fn flightsql_get_xdbc_type_info() {
Step::Custom(Box::new(move |state: &mut StepTestState| {
async move {
let mut client = flightsql_client(state.cluster());
// TODO chunchun: search by data_type test case
let data_type: Option<i32> = None;
let stream = client.get_xdbc_type_info(data_type).await.unwrap();
@ -1173,6 +1172,20 @@ async fn flightsql_get_xdbc_type_info() {
}
.boxed()
})),
Step::Custom(Box::new(move |state: &mut StepTestState| {
async move {
let mut client = flightsql_client(state.cluster());
// TODO chunchun: search by data_type test case
let data_type: Option<i32> = Some(6);
let err = client.get_xdbc_type_info(data_type).await.unwrap_err();
assert_matches!(err, FlightError::Tonic(..));
assert_contains!(err.to_string(), "GetXdbcTypeInfo does not yet support filtering by data_type");
}
.boxed()
})),
],
)
.run()