Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ impl Display for DataFusionError {
write!(f, "This feature is not implemented: {}", desc)
}
DataFusionError::Internal(ref desc) => {
write!(f, "Internal error: {}. This was likely caused by a bug in DataFusion's \
code and we would welcome that you file an bug report in our issue tracker", desc)
write!(f, "Internal error: {}", desc)
}
DataFusionError::Plan(ref desc) => {
write!(f, "Error during planning: {}", desc)
Expand Down
36 changes: 31 additions & 5 deletions datafusion/core/src/physical_plan/repartition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ use crate::error::{DataFusionError, Result};
use crate::physical_plan::hash_utils::create_hashes;
use crate::physical_plan::{DisplayFormatType, ExecutionPlan, Partitioning, Statistics};
use arrow::record_batch::RecordBatch;
use arrow::{array::Array, error::Result as ArrowResult};
use arrow::{
array::Array,
error::{ArrowError, Result as ArrowResult},
};
use arrow::{compute::take, datatypes::SchemaRef};
use tokio_stream::wrappers::UnboundedReceiverStream;

Expand Down Expand Up @@ -369,9 +372,8 @@ impl RepartitionExec {
.columns()
.iter()
.map(|c| {
take(c.as_ref(), &indices, None).map_err(|e| {
DataFusionError::Execution(e.to_string())
})
take(c.as_ref(), &indices, None)
.map_err(DataFusionError::ArrowError)
})
.collect::<Result<Vec<Arc<dyn Array>>>>()?;
let output_batch =
Expand Down Expand Up @@ -426,9 +428,33 @@ impl RepartitionExec {
}
// Error from running input task
Ok(Err(e)) => {
// try to unwrap nested errors
let mut err = &e;
let mut message = None;
// limit the number of unwraps to avoid potential infinite/deep loops
for _ in 0..100 {
if let DataFusionError::External(ext_err) = err {
message = Some(ext_err.to_string());
break;
}
let DataFusionError::ArrowError(arrow_err) = err else {
message = Some(err.to_string());
break;
};
let ArrowError::ExternalError(ext_err) = arrow_err else {
message = Some(arrow_err.to_string());
break;
};
let Some(df_err) = ext_err.downcast_ref::<DataFusionError>() else {
message = Some(ext_err.to_string());
break;
};
err = df_err;
}
let message = message.unwrap_or_else(|| err.to_string());
for (_, tx) in txs {
// wrap it because need to send error to all output partitions
let err = DataFusionError::Execution(e.to_string());
let err = DataFusionError::Execution(message.clone());
let err = Err(err.into());
tx.send(Some(err)).ok();
}
Expand Down
Loading