diff --git a/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs b/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs index a59394f90814..4d2a536c4920 100644 --- a/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs +++ b/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs @@ -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(()) } diff --git a/datafusion/physical-expr/src/scalar_function.rs b/datafusion/physical-expr/src/scalar_function.rs index 138774d806f2..45f77325eea3 100644 --- a/datafusion/physical-expr/src/scalar_function.rs +++ b/datafusion/physical-expr/src/scalar_function.rs @@ -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()) }; } }