alamb commented on code in PR #7917:
URL: https://github.com/apache/arrow-rs/pull/7917#discussion_r2237699220


##########
arrow-row/src/variable.rs:
##########
@@ -261,13 +262,29 @@ fn decode_binary_view_inner(
         valid
     });
 
-    let values_capacity: usize = rows.iter().map(|row| decoded_len(row, 
options)).sum();
+    let values_capacity = if validate_utf8 {

Review Comment:
   I think it will help to add context (aka the rationale of *WHY* this is 
being done) for future readers as I think it is pretty tricky and non obvious. 
Something like
   ```suggestion
       // If we are validating utf8, decode all string values (including short 
strings
       // that are inlined) into to the target buffer and validate utf8 once. 
If not validating,
       // save memory by only copying long strings to the buffer, avoiding 
short strings
       let values_capacity = if validate_utf8 {
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to