Skip to content

Commit

Permalink
Report current function name when invoke result length wrong (#13643)
Browse files Browse the repository at this point in the history
This makes for a more actionable error message.
  • Loading branch information
findepi authored Dec 5, 2024
1 parent e5422de commit 749cd6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ async fn test_row_mismatch_error_in_scalar_udf() -> Result<()> {
.err()
.unwrap()
.to_string(),
"UDF returned a different number of rows than expected"
"Internal error: UDF buggy_func returned a different number of rows than expected. Expected: 2, Got: 1"
);
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/scalar_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ impl PhysicalExpr for ScalarFunctionExpr {
return if preserve_scalar {
ScalarValue::try_from_array(array, 0).map(ColumnarValue::Scalar)
} else {
internal_err!("UDF returned a different number of rows than expected. Expected: {}, Got: {}",
batch.num_rows(), array.len())
internal_err!("UDF {} returned a different number of rows than expected. Expected: {}, Got: {}",
self.name, batch.num_rows(), array.len())
};
}
}
Expand Down

0 comments on commit 749cd6f

Please sign in to comment.