JasonLi-cn commented on code in PR #10006:
URL: 
https://github.com/apache/arrow-datafusion/pull/10006#discussion_r1558689810


##########
datafusion/functions/src/string/common.rs:
##########
@@ -78,6 +80,19 @@ pub(crate) fn general_trim<T: OffsetSizeTrait>(
         2 => {
             let characters_array = as_generic_string_array::<T>(&args[1])?;
 
+            if characters_array.len() == 1 {
+                if characters_array.is_null(0) {
+                    return Ok(new_null_array(args[0].data_type(), 
args[0].len()));

Review Comment:
   This is not a new behavior. The reason for this logic 
`characters_array.is_null(0)` is because initially, a test did not pass, and 
the error was as follows:
   ```shell
   ...
   
   External error: query result mismatch:
   [SQL] SELECT btrim(' xyxtrimyyx ', NULL)
   [Diff] (-expected|+actual)
   -   NULL
   +    xyxtrimyyx 
   at test_files/expr.slt:373
   
   ...
   
   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 
backtrace.
   error: test failed, to rerun pass `-p datafusion-sqllogictest --test 
sqllogictests`
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to