alamb commented on code in PR #6025:
URL: https://github.com/apache/arrow-rs/pull/6025#discussion_r1673235443
##########
parquet/src/arrow/buffer/dictionary_buffer.rs:
##########
@@ -162,6 +162,10 @@ impl<K: ArrowNativeType + Ord, V: OffsetSizeTrait>
DictionaryBuffer<K, V> {
let data = match cfg!(debug_assertions) {
true => builder.build().unwrap(),
+ // SAFETY: FIXME: this is unsound. data_type is passed by
the caller without
Review Comment:
I will review this more carefully -- I think this code is still sound as the
only callers of `data_type` pass in the correct type.
However, maybe we could double check the data_type with an assert
##########
parquet/src/arrow/array_reader/struct_array.rs:
##########
@@ -173,6 +173,7 @@ impl ArrayReader for StructArrayReader {
array_data_builder.null_bit_buffer(Some(bitmap_builder.into()));
}
+ // SAFETY: FIXME: document why this call is safe.
Review Comment:
The argument basically goes something like the code in this module correctly
constructed the struct array values and validated the input during the
construction.
##########
parquet/src/arrow/buffer/offset_buffer.rs:
##########
@@ -164,7 +168,8 @@ impl<I: OffsetSizeTrait> OffsetBuffer<I> {
let len = (end - start).to_usize().unwrap();
if len != 0 {
- // Safety: (1) the buffer is valid (2) the offsets are valid
(3) the values in between are of ByteViewType
Review Comment:
I think this code is slated for removal by @XiangpengHao in
https://github.com/apache/arrow-rs/pull/6040, FWIW
##########
parquet/src/arrow/array_reader/primitive_array.rs:
##########
@@ -179,6 +179,11 @@ where
.add_buffer(record_data)
.null_bit_buffer(self.record_reader.consume_bitmap_buffer());
+ // SAFETY: Assuming that the RecordReader's null buffer is
sufficiently sized for the
Review Comment:
I think the safety argument goes something like the RecordReader writes only
valid values for type `T` into `record_data` and that the record_reader's null
buffer was correctly created.
--
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]