Rich-T-kid commented on code in PR #12340:
URL: https://github.com/apache/arrow-rs/pull/12340#discussion_r4639103710


##########
arrow-csv/src/reader/records.rs:
##########
@@ -84,8 +84,26 @@ impl RecordDecoder {
         }
 
         // Reserve sufficient capacity in offsets
-        self.offsets
-            .resize(self.offsets_len + to_read * self.num_columns, 0);
+        let offsets_capacity = to_read
+            .checked_mul(self.num_columns)

Review Comment:
   I think this could be an option, the main concerns are the total LOC and any 
possible perf regressions this may cause. As noted in 
https://github.com/apache/arrow-rs/pull/11973 there can be signifcant 
regressions introduced when we add this checked logic to hot loops, adding a 
possible extra layer of indirection for dynamic dispatch may make that worse.
   
   



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