tustvold commented on code in PR #5322:
URL: https://github.com/apache/arrow-rs/pull/5322#discussion_r1461722316


##########
parquet/src/schema/types.rs:
##########
@@ -1085,20 +1085,38 @@ fn from_thrift_helper(elements: &[SchemaElement], 
index: usize) -> Result<(usize
                 ));
             }
             let repetition = 
Repetition::try_from(elements[index].repetition_type.unwrap())?;
-            let physical_type = 
PhysicalType::try_from(elements[index].type_.unwrap())?;
-            let length = elements[index].type_length.unwrap_or(-1);
-            let scale = elements[index].scale.unwrap_or(-1);
-            let precision = elements[index].precision.unwrap_or(-1);
-            let name = &elements[index].name;
-            let builder = Type::primitive_type_builder(name, physical_type)
-                .with_repetition(repetition)
-                .with_converted_type(converted_type)
-                .with_logical_type(logical_type)
-                .with_length(length)
-                .with_precision(precision)
-                .with_scale(scale)
-                .with_id(field_id);
-            Ok((index + 1, Arc::new(builder.build()?)))
+            if let Some(type_) = elements[index].type_ {
+                let physical_type = PhysicalType::try_from(type_)?;
+                let length = elements[index].type_length.unwrap_or(-1);
+                let scale = elements[index].scale.unwrap_or(-1);
+                let precision = elements[index].precision.unwrap_or(-1);
+                let name = &elements[index].name;
+                let builder = Type::primitive_type_builder(name, physical_type)
+                    .with_repetition(repetition)
+                    .with_converted_type(converted_type)
+                    .with_logical_type(logical_type)
+                    .with_length(length)
+                    .with_precision(precision)
+                    .with_scale(scale)
+                    .with_id(field_id);
+                Ok((index + 1, Arc::new(builder.build()?)))
+            } else {
+                let mut builder = 
Type::group_type_builder(&elements[index].name)
+                    .with_converted_type(converted_type)
+                    .with_logical_type(logical_type)
+                    .with_id(field_id);
+                if !is_root_node {
+                    // Sometimes parquet-cpp and parquet-mr set repetition 
level REQUIRED or

Review Comment:
   Is there some way we could test this?
   
   Edit: Nvm I see you manually do this belo



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