rgbuilds commented on code in PR #26195:
URL: https://github.com/apache/datafusion/pull/26195#discussion_r4291615186
##########
datafusion/datasource-parquet/src/file_format.rs:
##########
@@ -272,32 +272,83 @@ fn clear_metadata(
})
}
-/// Marks every field that is missing from at least one of the `file_count`
-/// files as nullable: reading such a file yields nulls for that column.
-fn mark_partially_present_fields_nullable(
- schema: Schema,
- presence: &HashMap<String, usize>,
- file_count: usize,
-) -> Schema {
- if presence.values().all(|&count| count == file_count) {
+/// Widen fields missing from some of their containing schemas. An absent
parent
+/// produces a null parent, not a null value for each required child, so
children
+/// are compared only across files in which their parent exists.
+fn mark_partially_present_fields_nullable(schema: Schema, sources: &[Schema])
-> Schema {
+ if sources.len() <= 1 {
Review Comment:
Good catch! I restored a safe fast path that returns when the recursive
source field trees are identical, both at the schema root and within unchanged
nested levels. I avoided the old top-level-name shortcut because it would hide
the missing-child case fixed here.
In a fresh optimized rerun, identical-schema inference improved by 2.92% for
32 x 128 and 0.23% for 256 x 1,024 versus the pre-fast-path version. Evolving
nested schemas cannot use the shortcut and retain a small inference cost.
--
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]