Jefffrey commented on code in PR #5630:
URL: https://github.com/apache/arrow-rs/pull/5630#discussion_r1581129208


##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -1436,6 +1436,35 @@ mod tests {
         assert_eq!(row_count, 300);
     }
 
+    #[test]
+    fn test_read_incorrect_map_schema_file() {
+        let testdata = arrow::util::test_util::parquet_test_data();
+        // see https://github.com/apache/parquet-testing/pull/47
+        let path = format!("{testdata}/incorrect_map_schema.parquet");
+        let file = File::open(path).unwrap();
+        let mut record_reader = ParquetRecordBatchReader::try_new(file, 
32).unwrap();
+
+        let batch = record_reader.next().unwrap().unwrap();
+        assert_eq!(batch.num_rows(), 1);
+
+        let expected_schema = Schema::new(Fields::from(vec![Field::new(
+            "my_map",
+            ArrowDataType::Map(
+                Arc::new(Field::new(
+                    "key_value",
+                    ArrowDataType::Struct(Fields::from(vec![
+                        Field::new("key", ArrowDataType::Utf8, false),
+                        Field::new("value", ArrowDataType::Utf8, true),
+                    ])),
+                    false,
+                )),
+                false.into(),
+            ),
+            true,
+        )]));
+        assert_eq!(batch.schema().as_ref(), &expected_schema);

Review Comment:
   Could perhaps build the expected MapArray using MapBuilder which allows 
specifying custom names?
   
   
https://github.com/apache/arrow-rs/blob/08af4710fcd2b56a7624db9b9d97e6715a952cb0/arrow-array/src/builder/map_builder.rs#L69-L93
   
   Or maybe just extract the relevant values from the actual MapArray for 
comparison since it's such a small array :thinking: 



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