Dandandan commented on a change in pull request #2128:
URL: https://github.com/apache/arrow-datafusion/pull/2128#discussion_r840891530
##########
File path: datafusion/physical-expr/src/string_expressions.rs
##########
@@ -343,18 +343,17 @@ pub fn concat_ws(args: &[ArrayRef]) -> Result<ArrayRef> {
.enumerate()
.map(|(index, x)| {
x.map(|sep: &str| {
- let mut owned_string: String = "".to_owned();
- for arg_index in 1..args.len() {
- let arg = &args[arg_index];
- if !arg.is_null(index) {
- owned_string.push_str(arg.value(index));
- // if not last push separator
- if arg_index != args.len() - 1 {
- owned_string.push_str(sep);
+ let string_vec = args[1..]
+ .iter()
+ .flat_map(|arg| {
+ if !arg.is_null(index) {
+ vec![arg.value(index)]
+ } else {
+ vec![]
Review comment:
```suggestion
if !arg.is_null(index) {
Some(arg.value(index))
} else {
None
}
```
--
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]