This is an automated email from the ASF dual-hosted git repository.

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 749cd6fff2 Report current function name when invoke result length 
wrong (#13643)
749cd6fff2 is described below

commit 749cd6fff2f5facdc98a2f12302e6200ca159f96
Author: Piotr Findeisen <[email protected]>
AuthorDate: Thu Dec 5 01:05:20 2024 +0100

    Report current function name when invoke result length wrong (#13643)
    
    This makes for a more actionable error message.
---
 datafusion/core/tests/user_defined/user_defined_scalar_functions.rs | 2 +-
 datafusion/physical-expr/src/scalar_function.rs                     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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 a59394f908..4d2a536c49 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 138774d806..45f77325ee 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())
                 };
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to