tustvold commented on code in PR #6671:
URL: https://github.com/apache/arrow-rs/pull/6671#discussion_r1828133873


##########
arrow-string/src/length.rs:
##########
@@ -137,6 +140,26 @@ pub fn bit_length(array: &dyn Array) -> Result<ArrayRef, 
ArrowError> {
             let list = array.as_string::<i64>();
             Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls()))
         }
+        DataType::Utf8View => {
+            let list = array.as_string_view();
+            let values = list
+                .views()
+                .iter()
+                .enumerate()
+                .map(|(i, _)| {
+                    if list.is_valid(i) {
+                        list.views()[i] as u32 * 8
+                    } else {
+                        0

Review Comment:
   Using from_unary reverts the optimisation of only inspect the views, and not 
the string data.
   
   Perhaps you might use the example I wrote in 
https://github.com/apache/arrow-rs/pull/6671#discussion_r1827848438



##########
arrow-string/src/length.rs:
##########
@@ -137,6 +140,26 @@ pub fn bit_length(array: &dyn Array) -> Result<ArrayRef, 
ArrowError> {
             let list = array.as_string::<i64>();
             Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls()))
         }
+        DataType::Utf8View => {
+            let list = array.as_string_view();
+            let values = list
+                .views()
+                .iter()
+                .enumerate()
+                .map(|(i, _)| {
+                    if list.is_valid(i) {
+                        list.views()[i] as u32 * 8
+                    } else {
+                        0

Review Comment:
   Using from_unary reverts the optimisation of only inspecting the views, and 
not the string data.
   
   Perhaps you might use the example I wrote in 
https://github.com/apache/arrow-rs/pull/6671#discussion_r1827848438



-- 
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