alamb commented on code in PR #21849:
URL: https://github.com/apache/datafusion/pull/21849#discussion_r3148813617
##########
datafusion/functions/src/string/replace.rs:
##########
@@ -160,25 +162,29 @@ fn replace_view(args: &[ArrayRef]) -> Result<ArrayRef> {
let from_array = as_string_view_array(&args[1])?;
let to_array = as_string_view_array(&args[2])?;
- let mut builder = GenericStringBuilder::<i32>::new();
+ let len = string_array.len();
+ let mut builder = GenericStringArrayBuilder::<i32>::with_capacity(len, 0);
let mut buffer = String::new();
+ let nulls = NullBuffer::union(
+ NullBuffer::union(string_array.nulls(), from_array.nulls()).as_ref(),
+ to_array.nulls(),
+ );
Review Comment:
A good use for the new `NullBuffer::union_many` eventually:
- https://github.com/apache/arrow-rs/pull/9692
##########
datafusion/functions/src/string/replace.rs:
##########
@@ -160,25 +162,29 @@ fn replace_view(args: &[ArrayRef]) -> Result<ArrayRef> {
let from_array = as_string_view_array(&args[1])?;
let to_array = as_string_view_array(&args[2])?;
- let mut builder = GenericStringBuilder::<i32>::new();
+ let len = string_array.len();
+ let mut builder = GenericStringArrayBuilder::<i32>::with_capacity(len, 0);
let mut buffer = String::new();
+ let nulls = NullBuffer::union(
+ NullBuffer::union(string_array.nulls(), from_array.nulls()).as_ref(),
+ to_array.nulls(),
+ );
Review Comment:
Filed a ticket to track that improvement:
- https://github.com/apache/datafusion/issues/21880
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]