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


##########
parquet/src/record/reader.rs:
##########
@@ -138,7 +138,15 @@ impl TreeBuilder {
                 .column_descr_ptr();
             let col_reader = row_group_reader.get_column_reader(orig_index)?;
             let column = TripletIter::new(col_descr, col_reader, 
self.batch_size);
-            Reader::PrimitiveReader(field, Box::new(column))
+            let reader = Reader::PrimitiveReader(field.clone(), 
Box::new(column));
+            if repetition == Repetition::REPEATED && path.len() == 1 {
+                if curr_def_level != 1 || curr_rep_level != 1 {
+                    return Err(ParquetError::General(format!("Top level 
REPEATED primitve field {} should have definition and repetition levels of 1", 
field.name())));

Review Comment:
   > Right but this could be contained in a nullable group for example
   
   In fact there's a test for this in parquet-testing (which is used by the 
`test_tree_reader_handle_repeated_fields_with_no_annotation` 
test)...`repeated_no_annotation.parquet`.  
   ```
   created by: parquet-rs version 0.3.0 (build 
b45ce7cba2199f22d93269c150d8a83916c69b5e)
   message user {
     REQUIRED INT32 id;
     OPTIONAL group phoneNumbers {
       REPEATED group phone {
         REQUIRED INT64 number;
         OPTIONAL BYTE_ARRAY kind (UTF8);
       }
     }
   ```
   But parquet-rs handles this case, so perhaps it's just the top level 
unannotated list that needs special handling.



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