Skip to content

Commit

Permalink
use substrait_err macro
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Dec 14, 2023
1 parent ea2555a commit 9f553e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 2 additions & 6 deletions datafusion/substrait/src/logical_plan/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,12 @@ pub async fn from_substrait_rel(
}
Some(RelType::Exchange(exchange)) => {
let Some(input) = exchange.input.as_ref() else {
return Err(DataFusionError::Substrait(
"Unexpected empty input in ExchangeRel".to_string(),
));
return substrait_err!("Unexpected empty input in ExchangeRel");
};
let input = Arc::new(from_substrait_rel(ctx, input, extensions).await?);

let Some(exchange_kind) = &exchange.exchange_kind else {
return Err(DataFusionError::Substrait(
"Unexpected empty input in ExchangeRel".to_string(),
));
return substrait_err!("Unexpected empty input in ExchangeRel");
};

// ref: https://substrait.io/relations/physical_relations/#exchange-types
Expand Down
6 changes: 2 additions & 4 deletions datafusion/substrait/src/logical_plan/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use datafusion::{
scalar::ScalarValue,
};

use datafusion::common::DFSchemaRef;
use datafusion::common::{exec_err, internal_err, not_impl_err};
use datafusion::common::{substrait_err, DFSchemaRef};
#[allow(unused_imports)]
use datafusion::logical_expr::aggregate_function;
use datafusion::logical_expr::expr::{
Expand Down Expand Up @@ -1822,9 +1822,7 @@ fn try_to_substrait_field_reference(
root_type: None,
})
}
_ => Err(DataFusionError::Substrait(format!(
"Expect a `Column` expr, but found {expr:?}"
))),
_ => substrait_err!("Expect a `Column` expr, but found {expr:?}"),
}
}

Expand Down

0 comments on commit 9f553e7

Please sign in to comment.