andygrove commented on code in PR #5786:
URL: https://github.com/apache/datafusion-comet/pull/5786#discussion_r4088069175


##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -810,6 +812,42 @@ fn check_conversion(
     }
 }
 
+/// A Comet cast is opaque to Parquet leaf clipping and decodes its entire 
input subtree.
+/// Check physical byte-identical names, not requested-name resolution, before 
that read.
+fn check_decoded_field_names(data_type: &DataType) -> DataFusionResult<()> {
+    match data_type {
+        DataType::Struct(fields) => {
+            let mut names = HashSet::with_capacity(fields.len());
+            for field in fields {
+                if !names.insert(field.name()) {
+                    return Err(duplicate_parquet_field_error(field.name()));
+                }
+                check_decoded_field_names(field.data_type())?;
+            }
+        }
+        DataType::List(field)
+        | DataType::LargeList(field)
+        | DataType::FixedSizeList(field, _)
+        | DataType::ListView(field)
+        | DataType::LargeListView(field)
+        | DataType::Map(field, _) => {

Review Comment:
   It is checked, one level down. The `Map` arm recurses into the entries 
field, which is a `Struct` of `key` and `value`, so the `Struct` arm walks both 
and recurses into the value's children. I confirmed it matters by dropping 
`DataType::Map` from that arm and rerunning. `duplicate Parquet field names - 
non-pruning map fails clearly` fails and nothing else does. The Rust map shape 
in `issue_5783_physical_duplicates_survive_arrow_and_fail_before_output` still 
passes without it, because it requests the duplicated name and 
`match_struct_fields` rejects it first.
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to