tustvold commented on a change in pull request #1490:
URL: https://github.com/apache/arrow-rs/pull/1490#discussion_r836215216



##########
File path: parquet/src/arrow/array_reader.rs
##########
@@ -929,20 +724,23 @@ impl<OffsetSize: OffsetSizeTrait> ArrayReader for 
ListArrayReader<OffsetSize> {
         // If a Parquet schema's only leaf is the list, then n = 0.
 
         // If the list index is at empty definition, the child slot is null
-        let null_list_indices: Vec<usize> = def_levels
+        let non_null_list_indices: Vec<u32> = def_levels
             .iter()
             .enumerate()
             .filter_map(|(index, def)| {
                 if *def <= self.list_empty_def_level {
-                    Some(index)
-                } else {
                     None
+                } else {
+                    Some(index as u32)
                 }
             })
             .collect();
-        let batch_values = match null_list_indices.len() {
-            0 => next_batch_array.clone(),
-            _ => remove_indices(next_batch_array.clone(), item_type, 
null_list_indices)?,
+        let batch_values = match non_null_list_indices.len() {
+            l if l == def_levels.len() => next_batch_array.clone(),
+            _ => {
+                let indices = UInt32Array::from(non_null_list_indices);

Review comment:
       You could remove the `collect` and then use `from_iter_values`, aside 
from being faster, this would also avoid unnecessary work in the no-nulls case.

##########
File path: parquet/src/arrow/array_reader.rs
##########
@@ -929,20 +724,23 @@ impl<OffsetSize: OffsetSizeTrait> ArrayReader for 
ListArrayReader<OffsetSize> {
         // If a Parquet schema's only leaf is the list, then n = 0.
 
         // If the list index is at empty definition, the child slot is null
-        let null_list_indices: Vec<usize> = def_levels
+        let non_null_list_indices: Vec<u32> = def_levels
             .iter()
             .enumerate()
             .filter_map(|(index, def)| {
                 if *def <= self.list_empty_def_level {
-                    Some(index)
-                } else {
                     None
+                } else {
+                    Some(index as u32)

Review comment:
       This could be more concisely written as `(*def > 
self.list_empty_def_level).then(|| index as u32)`




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