ivanvankov commented on pull request #9647: URL: https://github.com/apache/arrow/pull/9647#issuecomment-792297220
> I also think so, and also because no `unsafe` would be used. Our guidelines about `unsafe` is that there must be good justification for it, and I am trying to understand what is the justification exactly. > > E.g. since we have to validate that every entries' size are equal, couldn't we do it directly? e.g. something like this: > > ```rust > Some(v) => { // item is not null > let bytes = *v; > if let Some(size) = size { > if size != bytes.len() { > return Err(ArrowError::...); > } > } else { > // first time we see a len > size = Some(bytes.len()); > self.values > .extend_constant(&vec![0; bytes.len() * current_validity]); > }; > self.values.extend_from_slice(bytes); > self.validity.push(true); > ``` > > where `current_validity` tracks the number of nones up to when we get a size, and `size: Option<usize>` represents the current size (if known). You are actually absolutely right, no `unsafe` needed. Thanks! ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org