JasonLi-cn commented on code in PR #10006:
URL:
https://github.com/apache/arrow-datafusion/pull/10006#discussion_r1558715496
##########
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:
To provide additional context, this logic is consistent with the `_ => None`
here:
```rust
let result = string_array
.iter()
.zip(characters_array.iter())
.map(|(string, characters)| match (string, characters) {
(Some(string), Some(characters)) => Some(func(string,
characters)),
_ => None, // If characters is null, append None.
})
.collect::<GenericStringArray<T>>();
```
--
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]