etseidl commented on code in PR #6319:
URL: https://github.com/apache/arrow-rs/pull/6319#discussion_r1735078046


##########
parquet/src/file/metadata/writer.rs:
##########
@@ -450,19 +451,57 @@ mod tests {
             true,
         )]));
 
-        let a: ArrayRef = Arc::new(Int32Array::from(vec![Some(1), None, 
Some(2)]));
+        // build row groups / pages that exercise different combinations of 
nulls and values

Review Comment:
   I like these test additions, particularly that they build off of the tests 
added in #6197. They also seem much more thorough than what I proposed 😄 . 



##########
parquet/src/file/page_index/index.rs:
##########
@@ -227,19 +227,16 @@ impl<T: ParquetValueType> NativeIndex<T> {
     }
 
     pub(crate) fn to_thrift(&self) -> ColumnIndex {
-        let min_values = self
-            .indexes
-            .iter()
-            .map(|x| x.min_bytes().map(|x| x.to_vec()))
-            .collect::<Option<Vec<_>>>()
-            .unwrap_or_else(|| vec![vec![]; self.indexes.len()]);
-
-        let max_values = self
-            .indexes
-            .iter()
-            .map(|x| x.max_bytes().map(|x| x.to_vec()))
-            .collect::<Option<Vec<_>>>()
-            .unwrap_or_else(|| vec![vec![]; self.indexes.len()]);
+        let mut min_values = vec![vec![]; self.indexes.len()];
+        let mut max_values = vec![vec![]; self.indexes.len()];
+        for (i, index) in self.indexes.iter().enumerate() {
+            if let Some(min) = index.min_bytes() {
+                min_values[i].extend_from_slice(min);
+            }
+            if let Some(max) = index.max_bytes() {
+                max_values[i].extend_from_slice(max);
+            }
+        }

Review Comment:
   I know I'm responsible for this, but now I wonder if simply changing the 
above to something like:
   ```rust
           let min_values = self
               .indexes
               .iter()
               .map(|x| x.min_bytes().unwrap_or(&[]).to_vec())
               .collect::<Vec<_>>();
   ```
   would be more rusty?



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